Index: /extensions/Autosize/autosize.inc.php
===================================================================
--- /extensions/Autosize/autosize.inc.php	(revision 7374)
+++ /extensions/Autosize/autosize.inc.php	(revision 7375)
@@ -114,7 +114,10 @@
  * conflit =============================================
  */
-	static public function cl_autosize_script($pictures)
-	{	$my_path = dirname(__FILE__).'/';
-		   global  $template,$user,$conf ;
+	static public function cl_autosize_script()
+	{
+	   global  $template,$user,$conf ;
+
+ 
+		$my_path = dirname(__FILE__).'/';
 		$template->set_filenames(
 		     array('autosize_cl_init'=> $my_path.'template/cl_conflit.tpl')
@@ -128,7 +131,6 @@
 						 );
 
-		   $template->parse( 'autosize_cl_init', false);
-
- return $pictures;
+		   return $template->parse( 'autosize_cl_init', false);
+
        
 	}// function cl_autosize_script
Index: /extensions/Autosize/js/Affiche_script.js
===================================================================
--- /extensions/Autosize/js/Affiche_script.js	(revision 7374)
+++ /extensions/Autosize/js/Affiche_script.js	(revision 7375)
@@ -27,4 +27,11 @@
           var old_w = 0;
 
+          var llgboframe = jQuery("#gbo div:first");
+          var marges_llgbo = 0;
+          if (llgboframe.length > 0) {
+
+              marges_llgbo = jQuery(llgboframe).outerWidth() - jQuery("#gbo div:last").innerWidth();
+          }
+       
 
           //=========================================================
@@ -208,12 +215,6 @@
                   info_description.bottom = info_description.top = 1;
 
-              var llgboframe = jQuery("#gbo div:first");
-              var marges_llgbo = 0;
-              if (llgboframe.length > 0) {
-
-                  marges_llgbo = jQuery(llgboframe).outerWidth() - jQuery("#gbo div:last").innerWidth();
-              }
               if (theme.match(RegExp("gally", "g"))) {
-                  marges_llgbo = 0;
+                     marges_llgbo = 0;
               }
 
@@ -716,12 +717,12 @@
                   else
                       widthmin = parseInt(width_user);
-
+                 var marges = 0;
                   widthmin -= Get_Val_int(info_img.borderwidth.left);
                   widthmin -= Get_Val_int(info_img.borderwidth.right);
                   if (jQuery("#gbo") && jQuery("#gbo div:first").length > 0) {
                       llgboframe = jQuery("#gbo div:first");
-                      marges = jQuery(llgboframe).outerWidth() - jQuery("#gbo div:last").outerWidth();
+                      marges = jQuery(llgboframe).outerWidth() - jQuery("#gbo div:last").innerWidth();
                   }
-                  widthmin -=2*marges;
+                  widthmin -= 2 * marges;
                   if (Image_width > widthmin) {
                       //   Image_width largeur à atteindre 
@@ -761,13 +762,13 @@
                           _width = maxWidth;
                       } else {
-                          _width = Image_width - (marges/2);
+                          _width = Image_width - (marges / 2);
                       }
 
-                        jQuery("#gbo").outerWidth(_width);
-                        jQuery("#gbo").css("width", (_width) + "px");
-                        jQuery("#gbo").css("height", (Image_height) + "px");
-                        jQuery("#gbo").outerHeight(Image_height);
-                        Image_width = jQuery("#gbo div:last").innerWidth();
-                        Image_height = parseInt(Image_width / rapport);
+                      jQuery("#gbo").outerWidth(_width);
+                      jQuery("#gbo").css("width", (_width) + "px");
+                      jQuery("#gbo").css("height", (Image_height) + "px");
+                      jQuery("#gbo").outerHeight(Image_height);
+                      Image_width = jQuery("#gbo div:last").innerWidth();
+                      Image_height = parseInt(Image_width / rapport);
 
                   } else {
@@ -818,5 +819,5 @@
               }
 
-  
+
               jQuery(Cadre).width(zone_affichage.width);
               //==============================================================
@@ -947,5 +948,5 @@
 
       } // function
-);                                                                                                                                                                                                                                                                                                                 // ready
+);                                                                                                                                                                                                                                                                                                                  // ready
     /*
 *
Index: /extensions/Autosize/main.inc.php
===================================================================
--- /extensions/Autosize/main.inc.php	(revision 7374)
+++ /extensions/Autosize/main.inc.php	(revision 7375)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: AutoSize
-Version: 1.2.5
+Version: 1.2.6
 Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation
 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448
@@ -15,13 +15,7 @@
 $autosize_controler = new autosize_controler();
 
+add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), 95 );
 add_event_handler('get_admin_plugin_menu_links', array(&$autosize_controler,'cl_autosize_admin')  );
-
-//add_event_handler('loc_begin_page_header', array(&$autosize_controler,'cl_autosize_script'),20 );
-//add_event_handler('loc_begin_picture', array(&$autosize_controler,'cl_autosize_script'),20 );
-add_event_handler('loc_begin_page_tail', array(&$autosize_controler,'cl_autosize_script'),100 );
-
-add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), 95 ); 
-//add_event_handler('amd_jpegMD_loaded', array(&$autosize_controler, 'cl_autosize_affiche'),45);
-//add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), 100 ); 
+add_event_handler('load_profile_in_template', array(&$autosize_controler,'cl_autosize_script'),50 );
 
 ?>
