Index: extensions/Autosize/autosize.inc.php
===================================================================
--- extensions/Autosize/autosize.inc.php	(revision 19029)
+++ extensions/Autosize/autosize.inc.php	(revision 19030)
@@ -619,5 +619,4 @@
 					$template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('cl_bp', true));
 				}
-
 
 				 $template->set_filenames(
@@ -853,5 +852,4 @@
     $derivative=$current['derivatives'][$last_derivative] ;    
     $img_all= $derivative->get_all($derivative->src_image);
-    
 
     $retour = (object) '';
@@ -983,5 +981,4 @@
      }
 
-   if(preg_match("|get_infos|", $DEBUG_autosize, $val)) $infos_message .= $retour->type . " " . $retour->url ;
   if (!isset( $retour->type)){     
                   $retour=$last_image;
@@ -996,11 +993,7 @@
               
 }
-
-
-
       if($nofile > 0){  
         $set_miniature=$No_files ;
       }
-
 
     if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 
Index: extensions/Autosize/include/affiche.php
===================================================================
--- extensions/Autosize/include/affiche.php	(revision 19029)
+++ extensions/Autosize/include/affiche.php	(revision 19030)
@@ -59,8 +59,19 @@
  global $DEBUG_autosize;
 
+          $user_type= get_user_status($user_status)."_type";
+          $user_type=  $autosize_parametres->$user_type ;  
+          $select_type=ImageStdParams::get_by_type($user_type);
+          $ideal_size  =  $select_type->sizing->ideal_size ;  
+          if($user_type=="Autosize" || $user_type=="SelMaxi"){
+              $ideal_size[0]=$imgSizeWH[0];
+              $ideal_size[1]=$imgSizeWH[1];
+          }
+
  $slide_show = isset($page['slideshow'])?$page['slideshow']:false;
 
   	$template->assign(
   					array(  
+            'ideal_size_width' => $ideal_size[0] ,
+            'ideal_size_height' => $ideal_size[1] ,
             'has_pamoorama' => $has_pamoorama,
             'pictureMap' =>   $pictureDeriv ,
Index: extensions/Autosize/js/Affiche_script.js
===================================================================
--- extensions/Autosize/js/Affiche_script.js	(revision 19029)
+++ extensions/Autosize/js/Affiche_script.js	(revision 19030)
@@ -164,4 +164,5 @@
     //====================================
     set_cl = function (Valid) {
+
       if (typeof Valid == "undefined") Valid = options.pictureSelType.match(RegExp("Autosize", "gi")) || false;
       if (typeof options.cl_visible == "undefined") return;
@@ -190,4 +191,5 @@
 
       }
+
       if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") {
         Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
@@ -201,4 +203,10 @@
           }
         }
+        if (Type_Img == "pamoorama" || Type_Img == "iframe" || Type_Img == "charlie") {
+          zoom_cl = "";
+          src_info = "";
+          src = src2;
+        }
+
         jQuery('#bp_cla').attr('alt', src_info);
         jQuery('#bp_cla').attr('title', src_info);
@@ -573,6 +581,7 @@
       options.pictureDeriv = pictureDeriv;
     }
-    if (Type_Img == "pamoorama")
+    if (Type_Img == "pamoorama" || Type_Img == "iframe" || Type_Img == "charlie") {
       options.pictureSelType = "Autosize";
+    }
     for (i = 0; i < options.liste_type.length; i++) {
       options.liste_type[i] = options.liste_type[i].split(",");
@@ -600,4 +609,5 @@
 
         patname = href_path.replace("javascript\:", "");
+       if(typeof old_path == "undefined") old_path = patname;
         pt = pt.split(",");
         tsz = pt[pt.length - 1];
@@ -934,4 +944,11 @@
 
         if (Type_Img == "charlie" || Type_Img == "iframe") {
+          init_w1 = Zone_image.image.width;
+          init_h1 = Zone_image.image.height;
+
+          if (pictureSelType_user != "Autosize" && pictureSelType_user != "SelMaxi") {
+            init_w1 = Autosize_options.ideal_size_width;
+            init_h1 = Autosize_options.ideal_size_height;
+          }
           if (Type_Img == "charlie") {
             dp1 = jQuery("#charlie").offset();
@@ -941,6 +958,7 @@
                 wpng = Math.abs(dp.left - dp1.left) * 2;
             }
-            png_h = jQuery("#" + Type_Img + " div").height();
-            w01 = Math.ceil(jQuery("#" + "theImage").width() - wpng);
+            png_h = init_h1;
+            w01 = init_w1 - wpng;
+
             jQuery("#" + "theImage").css({ padding: 0 });
             if (!png_h) {
@@ -969,15 +987,11 @@
             }
             jQuery("#" + Type_Img).height(png_h);
-
-
             jQuery("#" + Type_Img + " div").width(w01);
-
-
-
+            jQuery("#theImage").css({ height: "auto" });
           } else {
             jQuery("#theImage").css({ height: "auto" });
             jQuery("#theMainImage").css({ width: "auto", height: "auto" });
-            jQuery("#" + Type_Img).attr("width", Zone_image.image.width - (infos_theMainImage.borderwidth.left + infos_theMainImage.borderwidth.right));
-            jQuery("#" + Type_Img).attr("height", Zone_image.image.height - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom));
+            jQuery("#" + Type_Img).attr("width", init_w1 - (infos_theMainImage.borderwidth.left + infos_theMainImage.borderwidth.right));
+            jQuery("#" + Type_Img).attr("height", init_h1 - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom));
           }
           jQuery("#" + Type_Img).show(options.fade_in);
@@ -2244,5 +2258,5 @@
 
 
-  });                                                                                           // ready
+  });                                                                                                     // ready
 
 
Index: extensions/Autosize/template/autosize.tpl
===================================================================
--- extensions/Autosize/template/autosize.tpl	(revision 19029)
+++ extensions/Autosize/template/autosize.tpl	(revision 19030)
@@ -3,4 +3,7 @@
  <script type="text/javascript"> 
 var  Autosize_options={ldelim}
+        ideal_size_width:'{$ideal_size_width}' ,
+        ideal_size_height:'{$ideal_size_height}' ,
+
         cl_version :'{$cl_version}',
         Version_pwg:'{$Version_pwg}',
