Index: /extensions/Back2Front/Back2Front.php
===================================================================
--- /extensions/Back2Front/Back2Front.php	(revision 11218)
+++ /extensions/Back2Front/Back2Front.php	(revision 11219)
@@ -32,28 +32,6 @@
     $conf['back2front'] = explode(',',$conf['back2front']);
     
-    // calculation of width and height
-    include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
-    
-    if (!empty($verso['width']))
-    {
-      list(
-        $verso['scaled_width'],
-        $verso['scaled_height']
-        ) = get_picture_size(
-          $verso['width'],
-          $verso['height'],
-          @$user['maxwidth'],
-          @$user['maxheight']
-        );
-    }
-
     /* websize picture */
-    $template->assign(array(
-      'VERSO_URL' => $verso['path'],
-      'VERSO_WIDTH' => $verso['scaled_width'],
-      'VERSO_HEIGHT' => $verso['scaled_height'],
-      'b2f_switch_mode' => $conf['back2front'][1],
-      'b2f_transition' => $conf['back2front'][2],
-    ));
+    $template->assign('VERSO_URL', $verso['path']);
     
     /* admin link */
@@ -70,15 +48,67 @@
       $template->assign('VERSO_HD', get_high_url($verso));
     }
+    
+    /* link name */
+    $conf['back2front'][4] = unserialize($conf['back2front'][4]);
+    if (!empty($conf['back2front'][4][$user['language']]))
+    {
+      if (strpos($conf['back2front'][4][$user['language']], '|') !== false)
+      {
+        $conf['back2front'][4] = explode('|', $conf['back2front'][4][$user['language']]);
+      }
+      else
+      {
+        $conf['back2front'][4] = array($conf['back2front'][4][$user['language']], $conf['back2front'][4][$user['language']]);
+      }
+    }
+    else if (!empty($conf['back2front'][4]['default']))
+    {
+      if (strpos($conf['back2front'][4]['default'], '|') != false)
+      {
+        $conf['back2front'][4] = explode('|', $conf['back2front'][4]['default']);
+      }
+      else
+      {
+        $conf['back2front'][4] = array($conf['back2front'][4]['default'], $conf['back2front'][4]['default']);
+      }
+    }
+    else
+    {
+      $conf['back2front'][4] = array(l10n('See back'), l10n('See front'));
+    }
 
     /* template & output */
-    $template->set_filenames(array('B2F_picture_content' => dirname(__FILE__).'/template/picture_content.tpl') );
-    $template->assign('B2F_PATH', B2F_PATH);
-    
-    return $template->parse('B2F_picture_content', true).$content;  
+    $template->set_filenames(array('B2F_picture_content' => dirname(__FILE__).'/template/picture_content.tpl') );    
+    $template->assign(array(
+      'B2F_PATH' => B2F_PATH,
+      'b2f_switch_mode' => $conf['back2front'][1],
+      'b2f_transition' => $conf['back2front'][2],
+      'b2f_position' => $conf['back2front'][3],
+      'b2f_see_back' => $conf['back2front'][4][0],
+      'b2f_see_front' => $conf['back2front'][4][1],
+    ));
+    
+    switch ($conf['back2front'][3])
+    {
+      case 'toolbar':
+        $template->set_prefilter('picture', 'Back2Front_toolbar_prefilter');  
+        break;
+      case 'top':
+        return $template->parse('B2F_picture_content', true)."\n".$content;
+        break;
+      case 'bottom':
+        return $content."\n".$template->parse('B2F_picture_content', true);
+        break;
+    }    
   }
-  else 
-  {
-    return $content;
-  }
+  
+  return $content;
+}
+
+function Back2Front_toolbar_prefilter($content, &$smarty)
+{
+  $search = '{/if}{/strip}{*caddie management END*}';
+  $replacement = $search."\n".file_get_contents(B2F_PATH.'template/picture_content.tpl');
+  return str_replace($search, $replacement, $content);
 }
 
@@ -87,9 +117,9 @@
  * Add field on picture modify page
  */
-function Back2Front_picture_modify($menu)
+function Back2Front_picture_modify()
 {
   global $page, $template, $conf;
   
-  if ($page['page'] != 'picture_modify') return $menu;
+  if ($page['page'] != 'picture_modify') return;
   $conf['back2front'] = explode(',',$conf['back2front']);
   
@@ -267,6 +297,4 @@
   
   $template->set_prefilter('picture_modify', 'Back2front_picture_modify_prefilter');
-  
-  return $menu;
 }
 
Index: /extensions/Back2Front/admin.php
===================================================================
--- /extensions/Back2Front/admin.php	(revision 11218)
+++ /extensions/Back2Front/admin.php	(revision 11219)
@@ -6,4 +6,6 @@
 $conf['back2front'] = explode(',', $conf['back2front']);
 
+include_once(B2F_PATH.'functions.inc.php');
+
 // Enregistrement de la configuration
 if (isset($_POST['submit']))
@@ -12,5 +14,7 @@
     $conf['back2front'][0], 
     $_POST['switch_mode'], 
-    $_POST['transition']
+    $_POST['transition'],
+    $_POST['position'],
+    serialize(stripslashes_deep(str_replace(array("'",'"',','), null, $_POST['link_name']))),
   );
 	
@@ -19,7 +23,27 @@
 }
 
+// Gestion des langues pour le bloc menu
+$conf['back2front'][4] = unserialize($conf['back2front'][4]);
+$template->append('link_name', array(
+  'LANGUAGE_NAME' => l10n('Default'),
+  'LANGUAGE_CODE' => 'default',
+  'VALUE' => @$conf['back2front'][4]['default'],
+  )
+);
+foreach (get_languages() as $language_code => $language_name)
+{
+	$template->append('link_name', array(
+    'LANGUAGE_NAME' => $language_name,
+    'LANGUAGE_CODE' => $language_code,
+    'VALUE' => isset($conf['back2front'][4][$language_code]) ? $conf['back2front'][4][$language_code] : '',
+    )
+  );
+}
+
 $template->assign(array(
+  'B2F_PATH' => B2F_PATH,
 	'SWITCH_MODE' => $conf['back2front'][1],
 	'TRANSITION' => $conf['back2front'][2],
+  'POSITION' => $conf['back2front'][3],
 ));
 	
Index: /extensions/Back2Front/functions.inc.php
===================================================================
--- /extensions/Back2Front/functions.inc.php	(revision 11218)
+++ /extensions/Back2Front/functions.inc.php	(revision 11219)
@@ -51,3 +51,11 @@
 }
 
+if (!function_exists('stripslashes_deep'))
+{
+  function stripslashes_deep($value)
+  {
+    return is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
+  }
+}
+
 ?>
Index: /extensions/Back2Front/main.inc.php
===================================================================
--- /extensions/Back2Front/main.inc.php	(revision 11218)
+++ /extensions/Back2Front/main.inc.php	(revision 11219)
@@ -26,6 +26,5 @@
 if (script_basename() == 'admin')
 {
-  add_event_handler('get_admin_plugin_menu_links', 'Back2Front_picture_modify');
-  // add_event_handler('loc_begin_admin_page', 'Back2Front_picture_modify'); /* for Piwigo 2.2.2 */
+  add_event_handler('loc_begin_admin_page', 'Back2Front_picture_modify');
   
 	add_event_handler('get_admin_plugin_menu_links', 'Back2Front_admin_menu');
Index: /extensions/Back2Front/maintain.inc.php
===================================================================
--- /extensions/Back2Front/maintain.inc.php	(revision 11218)
+++ /extensions/Back2Front/maintain.inc.php	(revision 11219)
@@ -39,4 +39,22 @@
 }
 
+function plugin_activate()
+{
+  global $conf;
+
+  if (!isset($conf['back2front'])) {
+    pwg_query("INSERT INTO `" . CONFIG_TABLE . "`
+      VALUES ('back2front', '".$versos_cat['id'].",click,none', 'Configuration for Back2Front plugin');");
+  } else {
+    $conf['back2front'] = explode(',', $conf['back2front']);
+    if (!isset($conf['back2front'][3])) {
+      $conf['back2front'][3] = 'top';
+      $conf['back2front'][4] = serialize(array('default'=>null));
+      conf_update_param('back2front', implode (',', $conf['back2front'])); 
+    }
+  }
+}
+
+
 function plugin_uninstall() {
 	global $conf, $prefixeTable;
Index: /extensions/Back2Front/template/admin.tpl
===================================================================
--- /extensions/Back2Front/template/admin.tpl	(revision 11218)
+++ /extensions/Back2Front/template/admin.tpl	(revision 11219)
@@ -1,2 +1,25 @@
+{combine_css path=$B2F_PATH|@cat:"template/style.css"}
+{if $themeconf.id == roma}<style type="text/css">.lang_help {ldelim} background-color:#464646; }</style>{/if}
+
+{footer_script require='jquery'}{literal}
+jQuery().ready( function () {
+  jQuery('select[name="lang_desc_select"]').change(function () {
+    jQuery('[id^="link_name"]').hide();
+    jQuery("#link_name_"+this.options[this.selectedIndex].value).show();
+  });
+  jQuery('[id^="link_name_"]').keyup(function () {
+    arr = jQuery(this).attr("id").split("link_name_");
+    id = arr[1];
+    opt = jQuery('select[name="lang_desc_select"] option[id="opt_'+id+'"]');
+    if (this.value != '')
+      opt.html(opt.html().replace("\u2718", "\u2714"));
+    else
+      opt.html(opt.html().replace("\u2714", "\u2718"));
+  });
+});
+
+jQuery('.lang_help').tipTip();
+{/literal}{/footer_script}
+
 <div class="titrePage">
 	<h2>Back2Front</h2>
@@ -7,4 +30,10 @@
 		<legend>{'Display'|@translate}</legend>	  
 		<ul>			
+      <li>
+        <span class="property">{'Link position'|@translate}</span>
+        <label><input type="radio" name="position" value="top" {if $POSITION == 'top'}checked="checked"{/if}/> {'Top'|@translate}</label>
+        <label><input type="radio" name="position" value="bottom" {if $POSITION == 'bottom'}checked="checked"{/if}/> {'Bottom'|@translate}</label>
+        <label><input type="radio" name="position" value="toolbar" {if $POSITION == 'toolbar'}checked="checked"{/if}/> {'Toolbar'|@translate}</label>
+      </li>
 			<li>
 				<span class="property">{'Switch mode'|@translate}</span>
@@ -16,5 +45,19 @@
 				<label><input type="radio" name="transition" value="none" {if $TRANSITION == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
 				<label><input type="radio" name="transition" value="fade" {if $TRANSITION == 'fade'}checked="checked"{/if}/> {'Fade'|@translate}</label>
-			</li>		
+			</li>	
+
+      <li>
+        <span class="property">{'Link name'|@translate}</span>
+        <select name="lang_desc_select">
+          {foreach from=$link_name item=lang}
+            <option value="{$lang.LANGUAGE_CODE}" id="opt_{$lang.LANGUAGE_CODE}">{if empty($lang.VALUE)}&#x2718;{else}&#x2714;{/if} &nbsp;{$lang.LANGUAGE_NAME}</option>
+          {/foreach}
+        </select>
+        {foreach from=$link_name item=lang}
+          <input type="text" size="30" name="link_name[{$lang.LANGUAGE_CODE}]" id="link_name_{$lang.LANGUAGE_CODE}" value="{$lang.VALUE}" style="{if $lang.LANGUAGE_CODE != 'default'}display:none; {/if}margin-left:10px;">
+        {/foreach}
+
+        <a class="lang_help" title="{'Seperate the two labels with the | symbol. Leave blank to use default translation.'|@translate}">i</a>
+      </li>      
 		</ul>
 	</fieldset>
Index: /extensions/Back2Front/template/picture_content.tpl
===================================================================
--- /extensions/Back2Front/template/picture_content.tpl	(revision 11218)
+++ /extensions/Back2Front/template/picture_content.tpl	(revision 11219)
@@ -1,3 +1,4 @@
 {combine_css path=$B2F_PATH|@cat:"template/style.css"}
+{combine_script id="jquery" load="header" path = "themes/default/js/jquery.min.js"}
 
 {footer_script require="jquery"}
@@ -16,18 +17,16 @@
         opacity:0
       }, 400, function() {ldelim}
+        jQuery(this).attr({ldelim}
+          src: '{$VERSO_URL}',
+          style: 'max-width:{$WIDTH_IMG}px;max-height:{$HEIGHT_IMG}px;',
+        });
         jQuery(this).animate({ldelim}
-          width:'{$VERSO_WIDTH}px',
-          height:'{$VERSO_HEIGHT}px'
-        }, 200, function() {ldelim}
-            jQuery(this).attr('src', '{$VERSO_URL}');
-            jQuery(this).animate({ldelim}
-              opacity:1
-            }, 400);
-        });
+          opacity:1
+        }, 400);
       });
     {else}
       jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
         src: '{$VERSO_URL}',
-        style: 'width:{$VERSO_WIDTH}px;height:{$VERSO_HEIGHT}px;',
+        style: 'max-width:{$WIDTH_IMG}px;max-height:{$HEIGHT_IMG}px;',
       });
     {/if}
@@ -42,5 +41,5 @@
     
       /* B2F link content */
-      jQuery(this).html('<img src="{$B2F_PATH}template/rotate_2.png"/> {'See front'|@translate}');
+      jQuery(this).html('<img src="{$B2F_PATH}template/rotate_2.png"/> {$b2f_see_front}');
       jQuery(this).attr('rel', 'back');
     {/if}
@@ -52,17 +51,16 @@
 {/if} 
 
+      /* picture switch */
     {if $b2f_transition == 'fade'}
       jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
         opacity:0
       }, 400, function() {ldelim}
+        jQuery(this).attr({ldelim}
+          src: '{$SRC_IMG}',
+          style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
+        });
         jQuery(this).animate({ldelim}
-          width:'{$WIDTH_IMG}px',
-          height:'{$HEIGHT_IMG}px'
-        }, 200, function() {ldelim}
-            jQuery(this).attr('src', '{$SRC_IMG}');
-            jQuery(this).animate({ldelim}
-              opacity:1
-            }, 400);
-        });
+          opacity:1
+        }, 400);
       });
     {else}
@@ -74,4 +72,5 @@
       
     {if $b2f_switch_mode == 'click'}
+      /* hd link */
       {if isset($high.U_HIGH)}
       jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
@@ -80,5 +79,6 @@
       {/if}
       
-      jQuery(this).html('<img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}');
+      /* B2F link content */
+      jQuery(this).html('<img src="{$B2F_PATH}template/rotate_1.png"/> {$b2f_see_back}');
       jQuery(this).attr('rel', 'front');
     {/if}
@@ -94,8 +94,9 @@
 {/footer_script}
 
-<img src="{$VERSO_URL}" style="display:none;"> {* <!-- force preload the verso --> *}
+<img src="{$VERSO_URL}" style="display:none;"/> {* <!-- force preload the verso --> *}
 
-<a class="reverse" rel="front" name="verso-link" {if $b2f_switch_mode == 'hover'}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
-  <img src="{$B2F_PATH}template/rotate_1.png"/> {'See back'|@translate}
+{if $b2f_position != 'toolbar'}<div>{/if}
+<a class="reverse" rel="front" {if $b2f_position == 'toolbar'}style="border:none !important;"{/if} {if $b2f_switch_mode == 'hover'}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
+  <img src="{$B2F_PATH}template/rotate_1.png"/> {$b2f_see_back}
 </a>
-<br/>
+{if $b2f_position != 'toolbar'}</div>{/if}
Index: /extensions/Back2Front/template/style.css
===================================================================
--- /extensions/Back2Front/template/style.css	(revision 11218)
+++ /extensions/Back2Front/template/style.css	(revision 11219)
@@ -5,10 +5,27 @@
   margin-bottom:10px;
   font-size:15px;
-  font-style:italic;	
-  height:1em;
+  font-style:italic;  
 }
 a.reverse img {
-  margin:0 !important;
   vertical-align:top;
-  border:none !important;
 }
+.lang_help {
+  display:inline-block;
+  width:16px;
+  text-align:center;
+  vertical-align:middle;
+  font-style:italic;
+  font-family:"Georgia",serif;
+  background-color:#999;
+  margin-left:15px;
+  color:#fff;
+  font-size:0.9em;
+  line-height:1.4em;
+  border-radius:7px;
+  -moz-border-radius:7px;
+}
+.lang_help:hover {
+  background-color:#333;
+  border:none;
+  color:#fff;
+}
