Changeset 18823
- Timestamp:
- Oct 31, 2012, 12:58:54 PM (11 years ago)
- Location:
- extensions/Autosize
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/autosize.inc.php
r18745 r18823 20 20 // | USA. | 21 21 // +-----------------------------------------------------------------------+ 22 class autosize_c ontroler{22 class autosize_ctrl { 23 23 /********************************* 24 24 * cl_autosize_admin … … 43 43 //============================================================================== 44 44 global $DEBUG_autosize; 45 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') { 46 $DEBUG_autosize=""; 47 }else{ 45 48 $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ; 46 49 $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] : $DEBUG_autosize ; 47 50 $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ; 48 51 //=============================================================== 49 50 52 } 53 if(preg_match("|event|", $DEBUG_autosize, $val)) $infos_message = "autosize_calcContent, " ; 54 if(preg_match("|test|", $DEBUG_autosize, $val )) { 55 echo cl_print_var($infos_message) ; 56 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 57 echo "COOKIE:" . cl_print_var($_COOKIE) ; 58 echo "GET:" . cl_print_var($_GET) ; 59 echo "POST:" . cl_print_var($_POST) ; 60 die(); 61 } 51 62 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 52 63 if ($ma_page !='thePicturePage') return ; … … 61 72 unset ( $_COOKIE['autosize_reload']) ; 62 73 } 63 64 if (!isset($_COOKIE['autosize_reload'])){ 65 autosize_controler::reload(); 74 if(!isset($_COOKIE['windowHeight'] )){ 75 self::reload(); 76 die(); 77 } 78 79 80 if (!isset($_COOKIE['autosize_reload']) ){ 81 self::reload(); 82 die(); 66 83 67 84 } … … 74 91 $imgSizeWH = $derivative->get_size(); 75 92 $SRC_IMG = $derivative->get_url(); 76 77 93 $picture['current']['scaled_width']=$imgSizeWH[0]; 78 94 $picture['current']['scaled_height']= $imgSizeWH[1]; 79 95 $picture['current']['high_url']= $SRC_IMG; 80 96 $picture['current']['image_url']=$SRC_IMG; 81 //===============================================================82 global $infos_message;83 84 97 //============================================================== 85 98 $autosize_parametres = cl_autosize_Get_Options(); … … 102 115 //======================================================= 103 116 global $has_pamoorama ; 117 118 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') { 119 $DEBUG_autosize=""; 120 }else{ 121 $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ; 122 $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] : $DEBUG_autosize ; 123 $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ; 124 //=============================================================== 125 } 126 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "init, ";} ; 127 104 128 $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false"; 105 129 $theme=$user['theme']; 106 $Css = autosize_controler::css($theme."-rules.css");107 130 131 $Css = self::css($theme."-rules.css"); 108 132 $css_slideshow=isset($Css['.Autosize']['slideshow'])?$Css['.Autosize']['slideshow']:"yes"; 109 133 $css_display= isset($Css['.Autosize']['display'])?$Css['.Autosize']['display']:"block"; … … 115 139 $pictureSelType = pwg_get_session_var('picture_sel_type',$pictureSelType); 116 140 141 if(preg_match("|test|", $DEBUG_autosize, $val)) { 142 echo $infos_message ; 143 if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ; 144 echo "Init: COOKIE:" . cl_print_var($_COOKIE) ; 145 echo "GET:" . cl_print_var($_GET) ; 146 echo "POST:" . cl_print_var($_POST) ; 147 die(); 148 } 149 150 117 151 if(!isset($_COOKIE['picture_sel_type'])){ 118 152 if($autosize_parametres->defaut_type=="off") … … 126 160 127 161 //===================================================================== 128 129 162 $current = $template->get_template_vars('current'); 130 131 132 //=== Zone affichage == 163 //=== Zone affichage == 164 $windowWidth=$_COOKIE['windowWidth'] ; 165 $windowHeight=$_COOKIE['windowHeight'] ; 166 133 167 $theImageTop= isset($_COOKIE['theImageTop'])?$_COOKIE['theImageTop']:0; 134 168 $theImageLeft=isset($_COOKIE['theImageLeft'])?$_COOKIE['theImageLeft']:0; … … 136 170 $theImageRight=isset($_COOKIE['theImageRight'])?$_COOKIE['theImageRight']:0; 137 171 $theImageBottom=isset($_COOKIE['theImageBottom'])?$_COOKIE['theImageBottom']:0; 138 $windowWidth=$_COOKIE['windowWidth'] ; 139 $windowHeight=$_COOKIE['windowHeight'] ; 172 140 173 141 174 $theImageMargeWidth=isset($_COOKIE['theImageMargeWidth']) ? $_COOKIE['theImageMargeWidth']:0; … … 143 176 144 177 $theImageMargeHeight -= 2; 145 146 178 if(isset($_COOKIE['theImageWidth'])){ 147 179 $theImageWidth= $_COOKIE['theImageWidth']; 148 180 $theImageHeight= $_COOKIE['theImageHeight'] ; 149 181 } 150 151 182 $theImageWidth= $windowWidth - $theImageLeft - $theImageMargeWidth; 152 183 $theImageHeight= $windowHeight - $theImageTop - $theImageMargeHeight ; 153 184 154 155 $retour = autosize_controler::get_min_max() ; 185 if ($element_info['is_gvideo']){ 186 $pictureDeriv=$default_size; 187 188 }else{ 189 190 191 $retour = self::get_min_max() ; 192 156 193 $theMainImageSize = $retour->get_size(); 194 $theMainImageWidth= isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']:$theMainImageSize[0]; 195 $theMainImageHeight= isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$theMainImageSize[1] ; 196 157 197 if($theImageHeight!=0 && $theImageWidth!=0){ 158 198 $pictureDeriv=$retour->type ; … … 160 200 $pictureDeriv=$default_size; 161 201 } 202 } 162 203 //============================================================ 163 204 pwg_set_session_var('picture_deriv',$pictureDeriv); … … 229 270 //===================================================================== 230 271 global $has_pamoorama,$pictureSelType,$pictureDeriv; 231 232 272 global $DEBUG_autosize; 273 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "init2, ";} ; 233 274 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize; 234 275 … … 242 283 243 284 $pattern =Array('/width=\"(\d+)\"/','/height=\"(\d+)\"/'); 244 245 246 285 $replacement = Array('',"style='height:".$theImageHeight."px'"); 247 286 $content= preg_replace($pattern, $replacement, $content); 248 249 287 if( $has_pamoorama=="true") return $content ; 250 288 251 289 if( !preg_match("|c1|", $DEBUG_autosize, $val) ) return $content ; 252 290 253 $theMainImageWidth= $_COOKIE['theMainImageWidth'] ; 254 $theMainImageHeight= $_COOKIE['theMainImageHeight'] ; 255 256 echo "theMainImageWidth :" . $theMainImageWidth . " X " . $theMainImageHeight . "<br >"; 291 //************************ c1 *************************************** 292 echo "theMainImageWidth :" . $theMainImageSize[0] . " X " . $theMainImageSize[1] . "<br >"; 257 293 echo "theImageWidth :" . $theImageWidth . " X " . $theImageHeight . "<br >"; 258 echo "theMainImageSize :" . $theMainImageSize[0]." > ". $theMainImageSize[1] ."<br />"; 294 295 echo $infos_message."<br />"; 259 296 260 297 $Ratio = $theMainImageSize[0]/$theMainImageSize[1]; … … 360 397 global $pictureSelType,$pictureDeriv,$infos_message,$conf; 361 398 global $DEBUG_autosize; 362 399 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_1, " ;} ; 363 400 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 364 401 if ($ma_page !='thePicturePage') return ; … … 427 464 global $has_pamoorama; 428 465 global $DEBUG_autosize; 429 466 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_2, ";} ; 430 467 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 431 468 if ($ma_page !='thePicturePage') return ; … … 468 505 global $has_pamoorama,$template,$page,$infos_message; 469 506 global $DEBUG_autosize; 470 507 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_3, ";} ; 471 508 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 472 509 if ($ma_page !='thePicturePage') return ; … … 521 558 global $has_pamoorama,$pictureSelType,$pictureDeriv; 522 559 global $DEBUG_autosize; 560 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_affiche, " ;} ; 561 523 562 $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 524 563 if ($ma_page !='thePicturePage') return ; … … 528 567 if(isset($set_miniature)){ 529 568 530 $set_miniature = autosize_controler::cl_autosize_nofile($set_miniature) ;569 $set_miniature = self::cl_autosize_nofile($set_miniature) ; 531 570 $template->append('footer_elements',$set_miniature); 532 571 } … … 781 820 global $liste_type,$img_all,$set_miniature,$template,$infos_message,$error_message,$has_pamoorama ; 782 821 global $theImageWidth,$theImageHeight,$pictureSelType,$pictureDeriv ; 822 global $DEBUG_autosize; 823 824 783 825 $current = $template->get_template_vars('current'); 784 826 $liste_type=""; … … 831 873 $No_files[$img_type] = $img_select ; 832 874 $nofile++ ; 875 if(preg_match("|get_infos|", $DEBUG_autosize, $val)) 876 $infos_message .=$nofile ." " ; 833 877 } 878 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) 879 $infos_message .=$img_url . " -> " . $img_type ."<br >"; 880 834 881 if(file_exists(PHPWG_ROOT_PATH.$img_url)){ } // if file 835 882 … … 901 948 902 949 $retour=(object)'' ; 950 951 952 953 903 954 if ($pictureSelType=="Autosize") $retour= $maxi_image ; 904 955 else if ($pictureSelType=="SelMaxi") $retour= $mini_image ; 956 905 957 else $retour=$last_image ; 906 958 if (!isset( $retour->type)){ … … 921 973 if($retour->type=="Original") 922 974 $retour->type=$last_derivative ; 975 976 if(preg_match("|get_minfos|", $DEBUG_autosize, $val)) 977 $infos_message .=$pictureSelType . " -> " . $retour->type . " : " . $retour->url ."<br >"; 978 923 979 return $retour ; 924 980 … … 1003 1059 1004 1060 $autosize_parametres = unserialize($conf['cl_autosize']); 1005 // $autosize_parametres = autosize_controler::Get_Options($autosize_parametres,'cl_autosize');1061 // $autosize_parametres = self::Get_Options($autosize_parametres,'cl_autosize'); 1006 1062 $autosize_parametres = cl_autosize_Set_Options(); 1007 1063 return $autosize_parametres; -
extensions/Autosize/js/Affiche_script.js
r18744 r18823 128 128 nbf = jQuery("#theImage" + " " + type_src).length; 129 129 frm1 = jQuery("#theImage" + " " + type_src).get(0); 130 Type_Img = " charlie";130 Type_Img = "iframe"; 131 131 132 132 //'fb - xfbml - like - button … … 145 145 } 146 146 } else { 147 jQuery(frm1).attr("id", " charlie");147 jQuery(frm1).attr("id", "iframe"); 148 148 } 149 149 … … 307 307 var aff_ok = false; 308 308 //======================================================================= 309 infos_theMainImage = jQuery(theMainImage_id).infos(true); 309 infos_theImage = jQuery(theImage_id).infos({ absolute: true }); 310 infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true }); 310 311 infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos(); // Cadre general 312 311 313 if (infos_theMainImage.width == 0) { 312 314 if (Type_Img == "charlie") { … … 314 316 theMainImage_id = "charlie"; 315 317 options.valide = true; 318 } else if (Type_Img == "iframe") { 319 320 infos_theMainImage = jQuery("#iframe").infos(true); 321 theMainImage_id = "iframe"; 322 options.valide = true; 323 324 infos_theMainImage.width = infos_theImage.general.width; 325 infos_theMainImage.height = infos_window.height - infos_theImage.top - options.marge_basse; 326 jQuery("#iframe").width(infos_theMainImage.width); 327 jQuery("#iframe").height(infos_theMainImage.height); 316 328 317 329 } else if (Type_Img == "pamoorama") { … … 407 419 height: zheight, 408 420 margesWidth: infos_window.width - infos_theImage.width 409 } 410 } 421 }, marges: { 422 height: 0, 423 width: 0 424 } 425 } 426 427 428 Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height); 429 430 431 432 411 433 /*********************************************************** 412 434 * RESIZE (une fois document chargé) … … 901 923 ***************************/ 902 924 Autosize_resize = function (force, parametres) { 903 904 925 n = Get_dimensions(true, options); 905 906 926 if (n == false) return; 907 908 927 Save_cookies(options); 909 928 if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") { … … 946 965 //jQuery(theMainImage_id).height(Zone_image.image.height); 947 966 } else { 948 967 if (options.imageAutosize==false) 949 968 if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") { 950 969 jQuery(theMainImage_id).height(Zone_image.image.height); … … 955 974 jQuery(theMainImage_id).width(Zone_image.image.width); 956 975 } 957 if (Type_Img == "charlie") { 958 swfobj = jQuery("#theMainImage").infos({ absolute: true }); 959 960 jQuery("#theMainImage_obj").attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 }); 961 jQuery("#theMainImage_emb").attr({ height: Zone_image.image.height, width: Zone_image.image.width }); 976 977 978 if (Type_Img == "charlie" || Type_Img == "iframe") { 979 swfobj = jQuery("#" + Type_Img).infos({ absolute: true }); 980 981 // jQuery("#" + Type_Img).attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 }); 982 // jQuery(theMainImage_obj).attr({ height: Zone_image.image.height, width: Zone_image.image.width - 50 }); 983 // jQuery(theMainImage_emb).attr({ height: Zone_image.image.height, width: Zone_image.image.width }); 962 984 963 985 } … … 1685 1707 options.marge_top = Math.ceil(new_img.top - new_dim.top); 1686 1708 options.marge_bottom = Math.ceil(new_dim.out.bottom - new_img.out.bottom); 1687 1688 options.theImageWidth = new_dim.width;1689 options.theImageHeight = new_dim.height;1690 1709 if (options.theImageBottom < 0) { 1691 1710 options.theImageBottom = 0; 1692 1711 } 1712 options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight; 1713 options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop; 1714 1693 1715 1694 1716 … … 1767 1789 break 1768 1790 1769 1791 case "iframe": 1792 Zone_image.image.width = options.theImageWidth; 1793 Zone_image.image.height = options.theImageHeight; 1794 break 1770 1795 case "pamoorama": 1771 1796 Wait_pamoorama(); 1772 1797 break 1773 1798 } 1799 1800 1774 1801 1775 1802 //================================================= -
extensions/Autosize/main.inc.php
r18731 r18823 2 2 /* 3 3 Plugin Name: AutoSize 4 Version: 2.11. 04 Version: 2.11.1 5 5 Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448 … … 30 30 include_once(AUTOSIZE_PATH.'autosize.inc.php'); 31 31 //================================================================== 32 global $page,$autosize_c ontroler;32 global $page,$autosize_ctrl; 33 33 if (!isset( $page['start'])) { 34 34 $page['start']=0; 35 35 } 36 $autosize_c ontroler = new autosize_controler();37 add_event_handler('get_admin_plugin_menu_links', array(&$autosize_c ontroler,'cl_autosize_admin') );36 $autosize_ctrl = new autosize_ctrl(); 37 add_event_handler('get_admin_plugin_menu_links', array(&$autosize_ctrl,'cl_autosize_admin') ); 38 38 39 if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') { 40 $DEBUG_autosize=""; 41 }else{ 42 $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ; 43 $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] : $DEBUG_autosize ; 44 $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ; 45 //=============================================================== 46 } 47 if(!preg_match("|NO|", $DEBUG_autosize, $val)) { 39 48 40 49 // init cl_autosize_script_1 cl_autosize_affiche 41 //Important avant pamooramics 42 add_event_handler('render_element_content', array(&$autosize_controler, 'autosize_calcContent'),40,2); 50 //Important avant pamooramics, gvideo 51 52 add_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'),EVENT_HANDLER_PRIORITY_NEUTRAL-11,2); 53 43 54 /**/ 44 add_event_handler('render_element_content', array(&$autosize_c ontroler,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2 );45 add_event_handler('render_element_content', array(&$autosize_c ontroler,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2 );46 add_event_handler('loc_after_page_header', array(&$autosize_c ontroler, 'cl_autosize_script_1') );47 add_event_handler('loc_after_page_header', array(&$autosize_c ontroler, 'cl_autosize_script_2') );48 add_event_handler('loc_after_page_header',array(&$autosize_c ontroler, 'cl_autosize_script_3') );49 add_event_handler('loc_after_page_header', array(&$autosize_c ontroler, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21 );55 add_event_handler('render_element_content', array(&$autosize_ctrl,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2 ); 56 add_event_handler('render_element_content', array(&$autosize_ctrl,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2 ); 57 add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1') ); 58 add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2') ); 59 add_event_handler('loc_after_page_header',array(&$autosize_ctrl, 'cl_autosize_script_3') ); 60 add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21 ); 50 61 } 62 } ; 51 63 52 64
Note: See TracChangeset
for help on using the changeset viewer.