Changeset 22367 for extensions/Autosize/autosize.inc.php
- Timestamp:
- Apr 26, 2013, 1:51:34 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/autosize.inc.php
r22360 r22367 773 773 $defined_types = array_keys(ImageStdParams::get_defined_type_map()); 774 774 foreach($defined_types as $type){ 775 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) $infos_message .= "$type, " ; 775 776 if($type!="Autosize" && $type!="SelMaxi" ){ 776 777 $last_derivative= $type ; … … 805 806 806 807 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){ 811 810 $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 ; 813 813 $max_crop = 0 ; 814 814 $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 816 820 if($img_type=="Autosize" || $img_type=="SelMaxi"){ 817 818 continue;821 $theImage_def +=1 ; 822 continue; 819 823 } 820 824 if(!file_exists(PHPWG_ROOT_PATH.$img_url)){ … … 823 827 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 824 828 $infos_message .= " File: $nofile <br>" ; 825 } 826 827 if(file_exists(PHPWG_ROOT_PATH.$img_url)){ 828 } // if file 829 829 } 830 830 if ($theImage_def==0){ 831 831 // Avant Autosize ou Original; 832 832 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; 836 836 if($ok==0){ 837 837 $last_image->type=$img_type; … … 840 840 } 841 841 }else{ 842 $last_derivative =$img_type ;843 $last_image =$img_select;842 $last_derivative = $img_type ; 843 $last_image = $img_select; 844 844 } 845 845 } 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){ 850 850 $mini_image= $img_select; 851 851 } … … 859 859 } 860 860 if( $img_type=="Original" && $theImage_def==0 ){ 861 $theImage_def =1;861 $theImage_def +=1; 862 862 $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(); 865 865 866 866 $default_image->type=$img_type; … … 869 869 870 870 } 871 $test= $imgWH[1] >= $theMainImageHeight;871 $test= ($imgWH[1] >= $theMainImageHeight); 872 872 if($has_pamoorama!=true){ 873 873 $test=( $imgWH[0] >= $theMainImageWidth) && $test; 874 } 874 } 875 875 //=================================================== 876 if($theImage_maxi==0) 877 if( $test==true ){ 878 $theImage_maxi=1; 876 if( $test==true ){ 877 $theImage_maxi +=1; 879 878 $maxi_image->type = $img_type; 880 879 $img_type=$img_select->get_type(); 881 if($img_type=="Original")882 $maxi_image = $last_image;883 else884 $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 895 894 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->url899 . " ---------- 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 900 899 . $max_crop ." -> " . $img_type . " <br>" 901 900 . print_r($imgWH,true). " <br >"; 902 if ($test) $infos_message .="</span >"; 901 if ($test) $infos_message .="</span >"; 902 903 903 } 904 904 } // for … … 907 907 $img_url = $img_select->src_image->get_url(); 908 908 $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] ; 910 913 911 914 $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 ; 914 917 else{ 915 918 $types = array_intersect(array_keys($liste_type), array($pictureSelType)); … … 917 920 $pictureSelType="Original"; 918 921 } 919 $retours = explode(",",$liste_type[$pictureSelType]);920 $retour =$SelType_image;922 $retours = explode(",",$liste_type[$pictureSelType]); 923 $retour = $SelType_image; 921 924 $retour->type=$retours[0]; 922 925 $retour->url=$retours[1]; … … 927 930 $retour->type = $retour->get_type(); 928 931 $retour->url = $retour->get_path(); 929 930 932 } 931 933 if (isset( $retour->type) && $retour->type=="Original" ){ … … 941 943 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) 942 944 $infos_message .= $pictureSelType . " -> " . $retour->type . " : " . 943 $retour->url . 945 $retour->url .cl_print_var($liste_type) . 944 946 cl_print_var($retour->get_size()) . "<br >"; 945 947
Note: See TracChangeset
for help on using the changeset viewer.