Index: /extensions/FacebookPlug/Plugin/admin.config.php
===================================================================
--- /extensions/FacebookPlug/Plugin/admin.config.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/admin.config.php	(revision 8440)
@@ -50,7 +50,7 @@
                l10n('Social plugins'),
                add_url_params($base_url, array('tab' => 'social_plugin')));
-$tabsheet->add('share',
-               l10n('Share'),
-               add_url_params($base_url, array('tab' => 'share')));
+$tabsheet->add('button',
+               l10n('Buttons'),
+               add_url_params($base_url, array('tab' => 'button')));
 $tabsheet->add('advanced',
                l10n('Advanced'),
@@ -122,8 +122,9 @@
     }
 
-    case 'share' :
+    case 'button' :
     {
       $conf['fbp']['share_picture'] = ! empty($_POST['FBP_SHARE_PICTURE']);
       $conf['fbp']['share_album'] = ! empty($_POST['FBP_SHARE_ALBUM']);
+      $conf['fbp']['upload_picture'] = ! empty($_POST['FBP_UPLOAD_PICTURE']);
       break;
     }
@@ -224,5 +225,5 @@
     break;
   }
-  case 'share' :
+  case 'button' :
   {
     $template->assign(
@@ -231,4 +232,5 @@
         'FBP_SHARE_PICTURE' => fbp_checked($conf['fbp']['share_picture']),
         'FBP_SHARE_ALBUM' => fbp_checked($conf['fbp']['share_album']),
+        'FBP_UPLOAD_PICTURE' => fbp_checked($conf['fbp']['upload_picture']),
         ));
     break;
Index: /extensions/FacebookPlug/Plugin/include/common.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/common.inc.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/include/common.inc.php	(revision 8440)
@@ -26,4 +26,5 @@
 include_once(dirname(__FILE__).'/constants.inc.php');
 include_once(FBP_DIR.'/include/conf.inc.php');
+include_once(FBP_DIR.'/include/functions.inc.php');
 include_once(FBP_DIR.'/include/header.inc.php');
 
Index: /extensions/FacebookPlug/Plugin/include/conf.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/conf.inc.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/include/conf.inc.php	(revision 8440)
@@ -39,4 +39,5 @@
     'share_picture' => true,
     'share_album' => true,
+    'upload_picture' => true,
     'allow_fb_access_private_page' => true,
     'social_plugin_like_button' => array(),
Index: /extensions/FacebookPlug/Plugin/include/constants.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/constants.inc.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/include/constants.inc.php	(revision 8440)
@@ -25,4 +25,6 @@
 
 define('FACEBOOK_APP_ID', '111499825588662');
+if (!defined('PIWIGO_FACEBOOK_UPLOAD_VERSION')) define('PIWIGO_FACEBOOK_UPLOAD_VERSION', '1.0');
+
 define('FACEBOOK_URL', 'http://www.facebook.com');
 define('FACEBOOK_PIWIGO_GROUP_URL', FACEBOOK_URL.'/Piwigo');
@@ -32,4 +34,6 @@
 define('FACEBOOK_DOC_PLUGINS_URL', FACEBOOK_DEV_URL.'/docs/reference/plugins');
 
+define('PIWIGO_FACEBOOK_UPLOAD_URL', 'http://facebook.piwigo.net/'.PIWIGO_FACEBOOK_UPLOAD_VERSION.'/upload_photo.php');
+
 define('FBP_DIR', dirname(dirname(__FILE__)));
 define('FBP_PATH' , PHPWG_PLUGINS_PATH.basename(FBP_DIR));
Index: /extensions/FacebookPlug/Plugin/include/functions.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/functions.inc.php	(revision 8440)
+++ /extensions/FacebookPlug/Plugin/include/functions.inc.php	(revision 8440)
@@ -0,0 +1,56 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | FacebookPlug - a Piwigo Plugin                                        |
+// | Copyright (C) 2010-2011 Ruben ARNAUD - rub@piwigo.org                 |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+  die('Hacking attempt!');
+}
+
+function fbp_add_bar_button()
+{
+  global $template;
+
+  switch (script_basename())
+  {
+    case 'index':
+    {
+      $action = 'PLUGIN_INDEX_ACTIONS';
+      break;
+    }
+    case 'picture':
+    {
+      $action = 'PLUGIN_PICTURE_ACTIONS';
+      break;
+    }
+  }
+
+  if (isset($action))
+  {
+    $template->assign('PIWIGO_FACEBOOK_UPLOAD_URL', PIWIGO_FACEBOOK_UPLOAD_URL);
+    $tpl = 'buttons';
+    $template->set_filename('fbp_'.$tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl');
+    $template->concat(
+          $action,
+          $template->parse('fbp_'.$tpl, true)
+          );
+  }
+}
+
+?>
Index: /extensions/FacebookPlug/Plugin/include/header.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/header.inc.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/include/header.inc.php	(revision 8440)
@@ -86,4 +86,5 @@
     $template->assign('FACEBOOK_LANGUAGE', fbp_get_fb_language());
     $template->assign('FBP_PATH', FBP_PATH);
+    $template->assign('FBP_SCRIPT_BASENAME', script_basename());
     $template->assign('fbp', $conf['fbp']);
     //~ $template->smarty->register_modifier('boolean_to_string', 'boolean_to_string');
@@ -136,5 +137,5 @@
         (script_basename() == 'picture')
         and
-        ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'] or $conf['fbp']['share_picture'])
+        ($conf['fbp']['social_plugin_like_button']['enabled'] or $conf['fbp']['social_plugin_facepile']['enabled'] or $conf['fbp']['social_plugin_comments']['enabled'] or $conf['fbp']['share_picture'] or $conf['fbp']['upload_picture'])
       )
       or
Index: /extensions/FacebookPlug/Plugin/include/index.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/index.inc.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/include/index.inc.php	(revision 8440)
@@ -88,5 +88,6 @@
       {
         set_make_full_url();
-        $page['fbp']['url_image'] = get_thumbnail_url($row);
+        $page['fbp']['url_image'] = get_element_url($row);
+        $page['fbp']['url_thumbnail_image'] = get_thumbnail_url($row);
         unset_make_full_url();
       }
@@ -112,22 +113,9 @@
       $picture = $pictures[rand(0, $C-1)];
       set_make_full_url();
-      $page['fbp']['url_image'] = get_thumbnail_url($picture);
+      $page['fbp']['url_image'] = get_element_url($picture);
+      $page['fbp']['url_thumbnail_image'] = get_thumbnail_url($picture);
       unset_make_full_url();
     }
   }
-}
-
-function fbp_loc_end_index()
-{
-  global $template;
-
-  $template->assign('FBP_SHARE_LI', true);
-
-  $tpl = 'share';
-  $template->set_filename('fbp_'.$tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl');
-  $template->concat(
-        'PLUGIN_INDEX_ACTIONS',
-        $template->parse('fbp_'.$tpl, true)
-        );
 }
 
@@ -144,5 +132,5 @@
 if ($conf['fbp']['share_album'])
 {
-  add_event_handler('loc_end_index', 'fbp_loc_end_index', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */);
+  add_event_handler('loc_end_index', 'fbp_add_bar_button', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */);
 }
 
Index: /extensions/FacebookPlug/Plugin/include/picture.inc.php
===================================================================
--- /extensions/FacebookPlug/Plugin/include/picture.inc.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/include/picture.inc.php	(revision 8440)
@@ -61,5 +61,6 @@
       $page['fbp']['url'] = make_picture_url(array('image_id' => $page['image_id']));
     }
-    $page['fbp']['url_image'] = get_thumbnail_url($current_picture);
+    $page['fbp']['url_image'] = get_element_url($current_picture);
+    $page['fbp']['url_thumbnail_image'] = get_thumbnail_url($current_picture);
     unset_make_full_url();
 
@@ -80,23 +81,10 @@
 }
 
-function fbp_loc_end_picture()
-{
-  global $template;
-
-  $template->assign('FBP_SHARE_LI', false);
-
-  $tpl = 'share';
-  $template->set_filename('fbp_'.$tpl, FBP_DIR.'/tpl/'.$tpl.'.tpl');
-  $template->concat(
-        'PLUGIN_PICTURE_ACTIONS',
-        $template->parse('fbp_'.$tpl, true)
-        );
-}
 
 add_event_handler('render_element_content', 'fbp_render_element_content', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /*in order to have picture content*/, 2);
 
-if ($conf['fbp']['share_picture'])
+if ($conf['fbp']['share_picture'] or $conf['fbp']['upload_picture'])
 {
-  add_event_handler('loc_end_picture', 'fbp_loc_end_picture', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */);
+  add_event_handler('loc_end_picture', 'fbp_add_bar_button', EVENT_HANDLER_PRIORITY_NEUTRAL+1 /* In order to be on right */);
 }
 
Index: /extensions/FacebookPlug/Plugin/language/en_UK/admin.config.lang.php
===================================================================
--- /extensions/FacebookPlug/Plugin/language/en_UK/admin.config.lang.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/language/en_UK/admin.config.lang.php	(revision 8440)
@@ -91,8 +91,8 @@
 $lang['Share album page'] = 'Share album page';
 $lang['Add a icon link on each album page to share on Facebook'] = 'Add a icon link on each album page to share on Facebook';
-//~ $lang[''] = '';
-//~ $lang[''] = '';
-//~ $lang[''] = '';
-//~ $lang[''] = '';
+$lang['Buttons'] = 'Buttons';
+$lang['Upload'] = 'Upload';
+$lang['Upload picture'] = 'Upload picture';
+$lang['Add a icon link on each picture page to upload image on Facebook'] = 'Add a icon link on each picture page to upload image on Facebook';
 //~ $lang[''] = '';
 //~ $lang[''] = '';
Index: /extensions/FacebookPlug/Plugin/language/en_UK/common.lang.php
===================================================================
--- /extensions/FacebookPlug/Plugin/language/en_UK/common.lang.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/language/en_UK/common.lang.php	(revision 8440)
@@ -28,4 +28,5 @@
 $lang['Via Facebook Piwigo application'] = 'Via Facebook Piwigo application';
 $lang['Share on Facebook'] = 'Share on Facebook';
+$lang['Upload photo on Facebook'] = 'Upload photo on Facebook';
 
 ?>
Index: /extensions/FacebookPlug/Plugin/language/fr_FR/admin.config.lang.php
===================================================================
--- /extensions/FacebookPlug/Plugin/language/fr_FR/admin.config.lang.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/language/fr_FR/admin.config.lang.php	(revision 8440)
@@ -91,5 +91,8 @@
 $lang['Share album page'] = 'Partager la page "album"';
 $lang['Add a icon link on each album page to share on Facebook'] = 'Ajout d\'une icone contenant un lien afin de partager sur Facebook chaque page \'album\'';
-
+$lang['Buttons'] = 'Boutons';
+$lang['Upload'] = 'Téléchargement';
+$lang['Upload picture'] = 'Télécharger une image';
+$lang['Add a icon link on each picture page to upload image on Facebook'] = 'Ajout d\'une icone contenant un lien afin de télécharger sur Facebook chaque image';
 
 ?>
Index: /extensions/FacebookPlug/Plugin/language/fr_FR/common.lang.php
===================================================================
--- /extensions/FacebookPlug/Plugin/language/fr_FR/common.lang.php	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/language/fr_FR/common.lang.php	(revision 8440)
@@ -28,4 +28,5 @@
 $lang['Via Facebook Piwigo application'] = 'Via l\'application Piwigo sur Facebook';
 $lang['Share on Facebook'] = 'Partager sur Facebook';
+$lang['Upload photo on Facebook'] = 'Télécharger la photo sur Facebook';
 
 ?>
Index: /extensions/FacebookPlug/Plugin/tpl/admin.config.tpl
===================================================================
--- /extensions/FacebookPlug/Plugin/tpl/admin.config.tpl	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/tpl/admin.config.tpl	(revision 8440)
@@ -224,7 +224,7 @@
 {/if}{* isset $social_plugin*}
 
-{if isset($share)}
-<fieldset>
-  <legend>{'Options'|@translate}</legend>
+{if isset($button)}
+<fieldset>
+  <legend>{'Share'|@translate}</legend>
   <ul>
     <li>
@@ -232,5 +232,5 @@
         <span class="property">{'Share picture page'|@translate}</span>
         <a class="HelptipTip" href="#" title="{'Add a icon link on each picture page to share on Facebook'|@translate}"><sup>{' (?)'|@translate}</sup></a>
-        <input type="checkbox" name="FBP_SHARE_PICTURE" {$share.FBP_SHARE_PICTURE} />
+        <input type="checkbox" name="FBP_SHARE_PICTURE" {$button.FBP_SHARE_PICTURE} />
       </label>
     </li>
@@ -239,10 +239,21 @@
         <span class="property">{'Share album page'|@translate}</span>
         <a class="HelptipTip" href="#" title="{'Add a icon link on each album page to share on Facebook'|@translate}"><sup>{' (?)'|@translate}</sup></a>
-        <input type="checkbox" name="FBP_SHARE_ALBUM" {$share.FBP_SHARE_ALBUM} />
-      </label>
-    </li>
-  </ul>
-</fieldset>
-{/if}{* isset $share*}
+        <input type="checkbox" name="FBP_SHARE_ALBUM" {$button.FBP_SHARE_ALBUM} />
+      </label>
+    </li>
+  </ul>
+</fieldset>
+<fieldset>
+  <legend>{'Upload'|@translate}</legend>
+  <ul>
+    <li>
+      <label>
+        <span class="property">{'Upload picture'|@translate}</span>
+        <a class="HelptipTip" href="#" title="{'Add a icon link on each picture page to upload image on Facebook'|@translate}"><sup>{' (?)'|@translate}</sup></a>
+        <input type="checkbox" name="FBP_UPLOAD_PICTURE" {$button.FBP_UPLOAD_PICTURE} />
+      </label>
+    </li>
+</fieldset>
+{/if}{* isset $button*}
 
 {if isset($advanced)}
Index: /extensions/FacebookPlug/Plugin/tpl/buttons.tpl
===================================================================
--- /extensions/FacebookPlug/Plugin/tpl/buttons.tpl	(revision 8440)
+++ /extensions/FacebookPlug/Plugin/tpl/buttons.tpl	(revision 8440)
@@ -0,0 +1,32 @@
+{* --------------------------------------------------------------------------- *}
+{if $fbp.share_picture or $fbp.share_album}
+{if $FBP_SCRIPT_BASENAME == 'index'}<li>{/if}
+{* method 1 *}
+{*
+<a name="fb_share" type="icon" share_url="{$fbp_page.url}" title="{'Share on Facebook'|@translate}"></a>
+<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" 
+        type="text/javascript">
+</script>
+*}
+{* method 2 *}
+{*
+<a href="http://www.facebook.com/sharer.php?u={$fbp_page.url|@urlencode}" title="{'Share on Facebook'|@translate}" rel="nofollow" onclick="window.open(this.href, 'Facebook','width=550,height=350,location=no,status=no,toolbar=no,scrollbars=no,menubar=no'); return false;"><img src="{$FBP_PATH|@cat:'/icon/share.png'}" class="button" alt="{'Share on Facebook'|@translate}"></a>
+*}
+{* method 3 *}
+<a href="{$fbp_page.url}" title="{'Share on Facebook'|@translate}" rel="nofollow"  onclick="share(this.href); return false;"><img src="{$FBP_PATH|@cat:'/icon/share.png'}" class="button" alt="{'Share on Facebook'|@translate}"></a>
+{literal}
+<script type="text/javascript">
+  //stream share method
+  function share(href)
+  {
+    FB.ui({method: 'stream.share', u: href});
+  }
+</script>
+{/literal}
+{if $FBP_SCRIPT_BASENAME == 'index'}</li>{/if}
+{/if} {* $fbp.share_picture or $fbp.share_album *}
+{* --------------------------------------------------------------------------- *}
+{if $fbp.upload_picture and $FBP_SCRIPT_BASENAME == 'picture'}
+<a href="{$PIWIGO_FACEBOOK_UPLOAD_URL}?u={$fbp_page.url_image|@urlencode}&amp;pu={$fbp_page.url|@urlencode}&amp;pt={$PAGE_TITLE|@replace:'"':' '}&amp;gt={$GALLERY_TITLE|@replace:'"':' '}" title="{'Upload photo on Facebook'|@translate}" rel="nofollow" onclick="window.open(this.href, 'Facebook','width=550,height=350,location=no,status=no,toolbar=no,scrollbars=no,menubar=no'); return false;"><img src="{$FBP_PATH|@cat:'/icon/upload.png'}" class="button" alt="{'Share on Facebook'|@translate}"></a>
+{/if} {* $fbp.upload_picture  and $FBP_SCRIPT_BASENAME == 'picture' *}
+{* --------------------------------------------------------------------------- *}
Index: /extensions/FacebookPlug/Plugin/tpl/init.fb.tpl
===================================================================
--- /extensions/FacebookPlug/Plugin/tpl/init.fb.tpl	(revision 8439)
+++ /extensions/FacebookPlug/Plugin/tpl/init.fb.tpl	(revision 8440)
@@ -20,5 +20,5 @@
 <meta property="og:site_name" content="{if isset($fbp_page.og.site_name)}{$fbp_page.og.site_name|@replace:'"':' '}{else}{$GALLERY_TITLE|@replace:'"':' '}{/if}">
 <meta property="og:type" content="{if isset($fbp_page.og.type)}{$fbp_page.og.type}{else}article{/if}">
-<meta property="og:image" content="{if isset($fbp_page.og.url_image)}{$fbp_page.og.url_image}{else}{$fbp_page.url_image}{/if}">
+<meta property="og:image" content="{if isset($fbp_page.og.image)}{$fbp_page.og.image}{else}{$fbp_page.url_thumbnail_image}{/if}">
 <meta property="og:url" content="{if isset($fbp_page.og.url)}{$fbp_page.og.url}"{else}{$fbp_page.url}{/if}">
 <meta property="fb:app_id" content="{if isset($fbp_page.og.app_id)}{$fbp_page.og.app_id}{else}{$FACEBOOK_APP_ID}{/if}">
Index: tensions/FacebookPlug/Plugin/tpl/share.tpl
===================================================================
--- /extensions/FacebookPlug/Plugin/tpl/share.tpl	(revision 8439)
+++ 	(revision )
@@ -1,24 +1,0 @@
-{if $FBP_SHARE_LI}<li>{/if}
-{* method 1 *}
-{*
-<a name="fb_share" type="icon" share_url="{$fbp_page.url}" title="{'Share on Facebook'|@translate}"></a>
-<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" 
-        type="text/javascript">
-</script>
-*}
-{* method 2 *}
-{*
-<a href="http://www.facebook.com/sharer.php?u={$fbp_page.url|@urlencode}" title="{'Share on Facebook'|@translate}" rel="nofollow" onclick="window.open(this.href, 'Facebook','width=550,height=350,location=no,status=no,toolbar=no,scrollbars=no,menubar=no'); return false;"><img src="{$FBP_PATH|@cat:'/icon/share.png'}" class="button" alt="{'Share on Facebook'|@translate}"></a>
-*}
-{* method 3 *}
-<a href="{$fbp_page.url}" title="{'Share on Facebook'|@translate}" rel="nofollow"  onclick="share(this.href); return false;"><img src="{$FBP_PATH|@cat:'/icon/share.png'}" class="button" alt="{'Share on Facebook'|@translate}"></a>
-{literal}
-<script type="text/javascript">
-  //stream share method
-  function share(href)
-  {
-    FB.ui({method: 'stream.share', u: href});
-  }
-</script>
-{/literal}
-{if $FBP_SHARE_LI}</li>{/if}
