Changeset 22367


Ignore:
Timestamp:
Apr 26, 2013, 1:51:34 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize update to piwigo 2.5 (fix bugs in admin )

Location:
extensions/Autosize
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/autosize.inc.php

    r22360 r22367  
    773773                $defined_types = array_keys(ImageStdParams::get_defined_type_map());
    774774                foreach($defined_types as $type){
     775                if(preg_match("|get_infos|", $DEBUG_autosize, $val)) $infos_message .= "$type, " ;
    775776                        if($type!="Autosize" && $type!="SelMaxi" ){
    776777                                $last_derivative= $type ;
     
    805806                 
    806807                if(preg_match("|get_infos|", $DEBUG_autosize, $val))
    807                         $infos_message .= "<br> get_min_max() $theMainImageWidth,$theMainImageHeight,$theContainerWidth,$theContainerHeight <br>" ;
    808 
    809                 foreach ($img_all as $img_select){
    810 
     808                        $infos_message .= "<br> get_min_max() $pictureSelType $theMainImageWidth,$theMainImageHeight,$theContainerWidth,$theContainerHeight <br>" ;
     809                foreach ($img_all as $img_select){
    811810                        $img_type  =  $img_select->get_type();
    812                         $img_url  = $img_select->get_path();
     811      $img_url  = $img_select->get_path();
     812      if ($img_type=="square" || $img_type=="thumb" ) continue ;
    813813                        $max_crop = 0 ;
    814814                        $imgWH  =  self::Get_Size($img_select);
    815                         if ($img_type=="square" || $img_type=="thumb" ) continue ;
     815                  if(preg_match("|get_infos|", $DEBUG_autosize, $val)){
     816                            $infos_message .= " $img_type $img_url ";
     817          $infos_message .=   $theImage_def. " Maxi:" . $theImage_maxi. " Mini:" . $theImage_mini;
     818          }
     819
    816820                        if($img_type=="Autosize" || $img_type=="SelMaxi"){
    817                                 $theImage_def +=1 ;
    818                                 continue;
     821                                $theImage_def +=1 ;
     822                                continue;
    819823                        }
    820824                        if(!file_exists(PHPWG_ROOT_PATH.$img_url)){
     
    823827                                if(preg_match("|get_infos|", $DEBUG_autosize, $val))
    824828                                        $infos_message .= " File: $nofile  <br>" ;
    825                         }
    826                                
    827                         if(file_exists(PHPWG_ROOT_PATH.$img_url)){
    828                         } // if file
    829 
     829                          }
    830830                        if ($theImage_def==0){
    831831                                // Avant Autosize ou Original;
    832832                                if($img_type=="Original") {
    833                                         $theImage_def = 1;
    834                                         $theImage_maxi=1;
    835                                         $theImage_mini=1;
     833                                        $theImage_def  += 1;
     834                                        $theImage_maxi += 1;
     835                                        $theImage_mini += 1;
    836836                                        if($ok==0){
    837837                                                $last_image->type=$img_type;
     
    840840                                        }
    841841                                }else{
    842                                         $last_derivative=$img_type ;
    843                                         $last_image= $img_select;
     842                                        $last_derivative = $img_type ;
     843                                        $last_image      = $img_select;
    844844                                }
    845845                        }
    846                         if ($theImage_maxi==0){
    847                                 $maxi_image=  $img_select;
    848                         }
    849                         if ($theImage_mini==0){
     846                        if ($theImage_maxi == 0){
     847                                $maxi_image =  $img_select;
     848                        }
     849                        if ($theImage_mini == 0){
    850850                                $mini_image=  $img_select;
    851851                        }
     
    859859                        }
    860860                        if( $img_type=="Original" && $theImage_def==0 ){
    861                                 $theImage_def=1;
     861                                $theImage_def +=1;
    862862                                $img_type = $last_derivative ;
    863                                 $img_url= $derivative->get_path();
    864                                 $imgWH = $derivative->get_size();
     863                                $img_url=   $derivative->get_path();
     864                                $imgWH =    $derivative->get_size();
    865865
    866866                                $default_image->type=$img_type;
     
    869869
    870870                        }
    871                         $test=$imgWH[1] >=  $theMainImageHeight;
     871                        $test= ($imgWH[1] >=  $theMainImageHeight);
    872872                         if($has_pamoorama!=true){
    873873                                $test=( $imgWH[0] >=  $theMainImageWidth) && $test;             
    874                          }
     874                         }     
    875875                                //===================================================
    876                         if($theImage_maxi==0)
    877                                 if( $test==true  ){
    878                                                 $theImage_maxi=1;
     876        if( $test==true  ){
     877                                                $theImage_maxi +=1;
    879878                                                $maxi_image->type =   $img_type;
    880879                                                $img_type=$img_select->get_type();
    881                                 if($img_type=="Original")
    882                                         $maxi_image = $last_image;
    883                                 else
    884                                         $maxi_image = $img_select;
    885                                        
    886                                 $maxi_image->url  =  $maxi_image->get_path();
    887 
    888                         } else {
    889 
    890                                 $mini_image->type=$img_type;
    891                                 $mini_image->url=$img_url;
    892                                 $mini_image=$img_select;
    893                                 $mini_image->url  =  $mini_image->get_path();
    894                         }
     880                                    if($img_type=="Original")
     881                                              $maxi_image = $last_image;
     882                                    else
     883                                             $maxi_image = $img_select;         
     884                                
     885                                    $maxi_image->url  =  $maxi_image->get_path();
     886                          } else {
     887                                  $mini_image->type=$img_type;
     888                                  $mini_image->url=$img_url;
     889                                  $mini_image = $img_select;
     890                                  $mini_image->url  =  $mini_image->get_path();         
     891                          }
     892     
     893
    895894                        if(preg_match("|get_infos|", $DEBUG_autosize, $val)){
    896                                 if (($imgWH[1] >= $theMainImageHeight))  $infos_message .="<span style='color:red'>";
    897                        
    898                                 $infos_message .= ($imgWH[1] >= $theMainImageHeight)."  Maxi:" . $maxi_image->url
    899                                          . " ---------- ImageUrl: $img_url "
     895                                if($test)  $infos_message .="<span style='color:red'>";                 
     896                                $infos_message .= "  Maxi_Url :" . $maxi_image->url
     897                                         . "  ImageUrl: $img_url "
     898                       . "  Mini_Url :" . $mini_image->url
    900899                                         . $max_crop ." -> " . $img_type . " <br>"
    901900                                                . print_r($imgWH,true). " <br >";
    902                                 if ($test)  $infos_message .="</span >";                               
     901                                if ($test)  $infos_message .="</span >";               
     902
    903903                                }
    904904                } // for
     
    907907                $img_url = $img_select->src_image->get_url();
    908908                $imgSizeWH  =  $img_select->src_image->get_size();
    909                 $liste_type["Original"]="Original".",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
     909    if(isset($liste_type["SelMaxi"])) die();
     910    $liste_type["SelMaxi"] = "SelMaxi".",".$img_url.",".$imgSizeWH[0]  .",".$imgSizeWH[1] ;
     911    $liste_type["Autosize"] = "Autosize".",".$img_url.",".$imgSizeWH[0]  .",".$imgSizeWH[1] ;
     912                $liste_type["Original"] = "Original".",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
    910913
    911914                $retour=(object)'' ;
    912                 if ($pictureSelType=="Autosize") $retour= $maxi_image ;
    913                 else if ($pictureSelType=="SelMaxi") $retour= $mini_image ;
     915                if ($pictureSelType=="Autosize")      $retour = $maxi_image ;
     916                else if ($pictureSelType=="SelMaxi")  $retour = $mini_image ;
    914917                else{
    915918                        $types = array_intersect(array_keys($liste_type), array($pictureSelType));
     
    917920                                $pictureSelType="Original";
    918921                        }
    919                         $retours=  explode(",",$liste_type[$pictureSelType]);
    920                         $retour=$SelType_image;
     922                        $retours =  explode(",",$liste_type[$pictureSelType]);
     923                        $retour  =  $SelType_image;
    921924                        $retour->type=$retours[0];
    922925                        $retour->url=$retours[1];
     
    927930                        $retour->type =  $retour->get_type();
    928931                        $retour->url  =  $retour->get_path();
    929 
    930932                }
    931933                if (isset( $retour->type) && $retour->type=="Original" ){
     
    941943                if(preg_match("|get_minfos|", $DEBUG_autosize, $val))
    942944                        $infos_message .= $pictureSelType . " -> " . $retour->type . " : "  .
    943                                         $retour->url  .
     945                                        $retour->url  .cl_print_var($liste_type) .
    944946                                 cl_print_var($retour->get_size()) .  "<br >";
    945947
  • extensions/Autosize/include/affiche.php

    r22360 r22367  
    1919//===========================================================================
    2020$size=  array(
    21             'src_img_h' => $imgSizeWH[1],
    22             'src_img_w' => $imgSizeWH[0],
    23             'window_height' =>$windowHeight,
    24             'window_width' => $windowWidth
     21            'src_img_h' => ($imgSizeWH[1]==0)?$_COOKIE['theMainImageHeight']:$imgSizeWH[1],
     22            'src_img_w' => ($imgSizeWH[0]==0)?$_COOKIE['theMainImageWidth']:$imgSizeWH[0],
     23            'window_height' =>($windowHeight==0)?$_COOKIE['windowHeight']:$windowHeight,
     24            'window_width' => ($windowWidth==0)?$_COOKIE['windowWidth']:$windowWidth
    2525          );
    26 if($imgSizeWH[1]==0){
    27           print_r($size);
    28           }
    29           $ratio=$imgSizeWH[0]/$imgSizeWH[1];
    30         if(preg_match("|fin_affiche|", $DEBUG_autosize, $val)){
    31 echo "<pre>";
    32 echo $DEBUG_autosize.$infos_message."
    33 ";
    34 print_r(explode(",","$infos_message"));
    35 print_r($events);
    36 
    37  echo  $pictureDeriv . " " . $pictureDeriv . " " . $pictureSelType;
    38 
    39 echo "WH: " . $windowHeight . "x " .$windowWidth;
    40 print_r($imgSizeWH);
    41         print_r($_COOKIE);
    42 
    43 
    44 die();
    45 }       
    46 
    47 
     26  $ratio=$size['src_img_w']/$size['src_img_h'];
    4827  $my_path = AUTOSIZE_PATH_ABS;
    49   $theme=$user['theme'];
    50  
     28  $theme=$user['theme']; 
    5129  $user_status = $user['status'] ;
    5230  $template->assign( array(
     
    6543      $value = $type_size;
    6644      if($type_size != "square" && $type_size != "thumb" )
    67       $options[$value] = $type_size;   
     45          $options[$value] = $type_size;   
    6846    } 
    6947 $autosize_parametres = cl_autosize_Get_Options();
     
    7856
    7957 //===========================================
    80 $COOKIE_PATH= cookie_path() ;
     58$COOKIE_PATH = cookie_path() ;
    8159
    8260
     
    169147                                );     
    170148
     149        if(preg_match("|fin_affiche|", $DEBUG_autosize, $val)){
     150      echo "<pre>";
     151      echo $DEBUG_autosize."<br>";
     152      echo "autosize_parametres; ";print_r($autosize_parametres);
     153      echo "infos_message; ";print_r(explode(",","$infos_message"));
     154      echo "events; ";print_r($events);
     155      echo  $pictureDeriv . " " . $pictureDeriv . " " . $pictureSelType;
     156      echo "WH: " . $windowHeight . "x " .$windowWidth;
     157      echo "Size : ".print_r($size);
     158            echo "COOKIE:".print_r($_COOKIE);
     159
     160
     161die();
     162}       
     163
    171164                           
    172165 //unset($_POST);
  • extensions/Autosize/js/Affiche_script.js

    r22360 r22367  
    1 // problème avec GMaps+diaporama:
     1// problème avec GMaps+diaporama:
    22// corriger   gmaps_pip.class.inc.php ajouter ligne 90 if ( !isset($_GET['slideshow']))
    33//============================================================== 
     
    218218
    219219          }
    220           Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
     220          Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
    221221          zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ;
    222222          if (!Valid) {
     
    448448        break;
    449449      }
     450    }
     451   
     452
     453    if (jQuery("#derivativeCheckedSelMaxi").length == 0) {
     454      m1 = '<span style="visibility: hidden;" id="derivativeCheckedSelMaxi" class="switchCheck">✔ </span>';
     455      m1 += '<a style="visibility: visible;" href=""> SelMaxi<span class="derivativeSizeDetails"> (800 x 600)</span> </a><br>';
     456      m1 += '<span style="visibility: hidden;" id="derivativeCheckedAutosize" class="switchCheck">✔ </span>';
     457      m1 += '<a style="visibility: visible;" href=""> Autosize<span class="derivativeSizeDetails"> (800 x 600)</span> </a><br>';
     458      jQuery("#derivativeSwitchBox").append(m1);
     459
    450460    }
    451461    options.liste_type = new_liste;
     
    10401050          return;
    10411051        }
    1042         // jQuery(theImg).width(Zone_image.image_init.width);
    1043         for (n in options.liste_type) {
    1044           if (options.liste_type[n][0] == options.pictureSelType) {
    1045             Zone_image.image_init.height = options.liste_type[n][3];
    1046             Zone_image.image_init.width = options.liste_type[n][2];
    1047             break;
    1048           }
    1049         }
    1050 
    1051 
    10521052        jQuery(theImg).height(Zone_image.image_init.height);
    10531053        set_cl("no");
     
    11151115            if (img_objs.length > 0) {
    11161116              jQuery(img_objs).each(function (e) {
    1117              //   init_h1 = jQuery(this).height();
    1118              //   init_w1 = jQuery(this).width();
    1119               }); 
     1117                //   init_h1 = jQuery(this).height();
     1118                //   init_w1 = jQuery(this).width();
     1119              });
    11201120            }
    11211121            dp1 = jQuery("#charlie").offset();
     
    11341134              w01 = Math.ceil(h01 * Zone_image.image.rapport);
    11351135            }
    1136             jQuery("#theMainImage").height(png_h );
     1136            jQuery("#theMainImage").height(png_h);
    11371137            jQuery("#theMainImage").width(w01 + wpng);
    11381138            jQuery("#theMainImage").css({ verticalAlign: "middle",
     
    11531153
    11541154
    1155        //     jQuery("#charlie object").attr("width", w01);
     1155            //     jQuery("#charlie object").attr("width", w01);
    11561156            jQuery("#charlie    object").attr("height", h01);
    1157         //    jQuery("#charlie embed").attr("width", w01); // firefox opera
     1157            //    jQuery("#charlie embed").attr("width", w01); // firefox opera
    11581158            jQuery("#charlie embed").attr("height", h01);
    11591159            jQuery("#charlie  embed").css("margin", "auto");
     
    14341434        options.pictureDeriv = last_id;
    14351435
    1436         return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: pt[n][2], height: pt[n][3] };
     1436        return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: parseInt(pt[n][2]), height: parseInt(pt[n][3]) };
    14371437      }
    14381438      return { imgSrc: "", pictureDeriv: "", width: "", height: "" };
     
    14451445    Select_Image = function () {
    14461446      memoire = options.imgSrc;
    1447       if (options.imgSrc.match(RegExp("gif", "gi")))
     1447      if (options.imgSrc.match(RegExp(".gif", "gi")))
    14481448        return;
    14491449      var pt = options.liste_type;
     
    14761476          return;
    14771477        }
    1478         Zone_image.zoom = Math.ceil(Zone_image.image.height / Zone_image.image_init.height);
     1478        Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
    14791479        if (!theImg.src)
    14801480          return true;
     
    19421942        }
    19431943
    1944         marges_llgbo = options.marges_llgbo;
     1944        marges_llgbo = options.marges_llgbo; // 48 !
    19451945      }
    19461946
     
    22112211    // ==========================================================
    22122212
    2213   });                                                 // ready
     2213  });                                                         // ready
    22142214  jQuery("#derivativeSwitchBox a").click(function (e) {
    22152215    k1 = 0;
  • extensions/Autosize/maintain.inc.php

    r22122 r22367  
    114114            $arr = @unserialize($conf['derivatives']);
    115115            if(!isset($arr['d']['Autosize'])){   
    116                   $arr['d']['SelMaxi']=ImageStdParams::get_custom(9,9);
    117                   $arr['d']['Autosize']=ImageStdParams::get_custom(10, 10); 
     116                  $arr['d']['SelMaxi']=ImageStdParams::get_custom(800,600);
     117                  $arr['d']['Autosize']=ImageStdParams::get_custom(1008, 756); 
    118118                  $conf['derivatives']=serialize($arr);
    119119                  $arr = @unserialize($conf['derivatives']);       
Note: See TracChangeset for help on using the changeset viewer.