Index: extensions/Autosize/autosize.inc.php
===================================================================
--- extensions/Autosize/autosize.inc.php	(revision 18949)
+++ extensions/Autosize/autosize.inc.php	(revision 18975)
@@ -580,11 +580,17 @@
 $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
 if ($ma_page !='thePicturePage') return ;  
- 
-
-
     if(isset($set_miniature)){
-        
+
           $set_miniature = self::cl_autosize_nofile($set_miniature) ;
-          	     $template->append('footer_elements',$set_miniature);  
+          $set_miniatures= explode("script",$set_miniature);
+          if(preg_match("|noGen|", $DEBUG_autosize, $val)) { 
+          if(count($set_miniatures)> 1 )
+                $infos_message .= "PictureDeriv:" . $pictureDeriv. ' miniature:' . cl_print_var( $set_miniature); 
+                 
+            }else { 
+                
+                
+          } ; 
+          $template->append('footer_elements',$set_miniature);  
       }
          
@@ -1024,6 +1030,6 @@
  //=== verification fichiers absents ===
  global $infos_message,$error_message;
-    global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
-
+ global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
+global  $pictureDeriv;
   $ok=false ;
  $nofiles=array();
@@ -1032,5 +1038,5 @@
  $nosrc=false ;
  $ok=true ;
- $listes="";
+ $listes="";      
   foreach ($img_all as $img_select){
     $img_url  = $img_select->get_url();
@@ -1046,5 +1052,5 @@
               $id  =  $img_select->src_image->id;	          
               $file_no->id=$id ;
-              $file_no->type=$img_type ;  
+              $file_no->type=$img_type ; 
               array_push($nofiles,serialize($file_no)) ;              
       }
@@ -1056,22 +1062,32 @@
   //=======================================================================================
     if($nosrc!=true  ){
-      $exec_miniatures = "<script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js' ></script>";      
-        $exec_miniatures .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
-        $nosrc=true ;
+      $script_miniatures = "<script type='text/javascript' src='".PHPWG_ROOT_PATH."themes/default/js/plugins/jquery.ajaxmanager.js' ></script>";      
+      $script_miniatures .= "<script type='text/javascript' src='".PHPWG_ROOT_PATH."plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
+      $nosrc=true ;
     }  
-      $exec_miniatures .= "<script type='text/javascript'>
+   
+     
+   $exec_miniatures ="";
+      $script_miniatures .= "<script type='text/javascript'>
         var nofile=Array(";
-        for ($i=0;$i < count($nofiles);$i++){        
-             $file=unserialize($nofiles[$i]);
+        for ($i=0;$i  <  count($nofiles)-1 ;$i++){        
+             $file = unserialize($nofiles[$i]);
              $exec_miniatures .=  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'},\n" ;
           }  
-        if($i>0) $exec_miniatures .=  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ;
-          $exec_miniatures .=  "); </script>\n" ;                 
-          $exec_miniatures .= "<script type='text/javascript' > 
+          if($i  <  count($nofiles))
+          {   $file = unserialize($nofiles[$i]);
+             $exec_miniatures .=  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ;
+             }
+             /*** Un seul ***********/
+             $file = unserialize($nofiles[count($nofiles)-1]);
+             $exec_miniatures =  "{id:'".$file->id."',type:'". $file->type."',file:'". $file->url."',width:'".$theMainImageSize[0]."', height:'".$theMainImageSize[1]."'}" ;
+
+          $script_miniatures  .= $exec_miniatures . "); </script>\n" ;                 
+          $script_miniatures  .= "<script type='text/javascript' > 
           if(typeof nofile!='undefined')
               getDerivativeUrls(nofile);
       </script>";
       //================================================================================== 
-      return $exec_miniatures ;
+      return $script_miniatures  ;
     }
  }
