Changeset 18823


Ignore:
Timestamp:
Oct 31, 2012, 12:58:54 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4 (compatible gvideo)

Location:
extensions/Autosize
Files:
3 edited

Legend:

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

    r18745 r18823  
    2020// | USA.                                                                  |
    2121// +-----------------------------------------------------------------------+
    22 class autosize_controler {
     22class autosize_ctrl {
    2323        /*********************************
    2424        * cl_autosize_admin
     
    4343    //==============================================================================
    4444  global $DEBUG_autosize;
     45  if( isset($_GET['cl_debug']) && $_GET['cl_debug'] =='false') {
     46      $DEBUG_autosize="";
     47  }else{
    4548    $DEBUG_autosize = isset($_POST['cl_debug']) ? $_POST['cl_debug'] : "" ;
    4649    $DEBUG_autosize = isset($_GET['cl_debug']) ? $_GET['cl_debug'] :  $DEBUG_autosize ;
    4750    $DEBUG_autosize = isset($conf['cl_debug']) ? $conf['cl_debug']."," . $DEBUG_autosize : $DEBUG_autosize ;
    4851 //===============================================================
    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 }
    5162    $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 
    5263   if ($ma_page !='thePicturePage') return ;
     
    6172          unset (  $_COOKIE['autosize_reload']) ;
    6273    }
    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();
    6683
    6784    } 
     
    7491    $imgSizeWH = $derivative->get_size();
    7592    $SRC_IMG    = $derivative->get_url();
    76 
    7793    $picture['current']['scaled_width']=$imgSizeWH[0];
    7894    $picture['current']['scaled_height']= $imgSizeWH[1];
    7995    $picture['current']['high_url']= $SRC_IMG;   
    8096    $picture['current']['image_url']=$SRC_IMG; 
    81 //===============================================================
    82   global $infos_message;
    83 
    8497//==============================================================
    8598    $autosize_parametres = cl_autosize_Get_Options();
     
    102115//======================================================= 
    103116global $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}
     126if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .=  "init, ";} ;
     127
    104128  $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false";
    105129  $theme=$user['theme']; 
    106   $Css = autosize_controler::css($theme."-rules.css");
    107130 
     131  $Css = self::css($theme."-rules.css"); 
    108132  $css_slideshow=isset($Css['.Autosize']['slideshow'])?$Css['.Autosize']['slideshow']:"yes";
    109133  $css_display= isset($Css['.Autosize']['display'])?$Css['.Autosize']['display']:"block"; 
     
    115139$pictureSelType = pwg_get_session_var('picture_sel_type',$pictureSelType); 
    116140
     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
    117151if(!isset($_COOKIE['picture_sel_type'])){
    118152   if($autosize_parametres->defaut_type=="off")
     
    126160
    127161//=====================================================================
    128 
    129162  $current = $template->get_template_vars('current');
    130 
    131 
    132    //=== Zone affichage ==
     163   //=== Zone affichage ==       
     164      $windowWidth=$_COOKIE['windowWidth'] ;
     165      $windowHeight=$_COOKIE['windowHeight'] ;
     166
    133167      $theImageTop= isset($_COOKIE['theImageTop'])?$_COOKIE['theImageTop']:0;
    134168      $theImageLeft=isset($_COOKIE['theImageLeft'])?$_COOKIE['theImageLeft']:0;
     
    136170       $theImageRight=isset($_COOKIE['theImageRight'])?$_COOKIE['theImageRight']:0;
    137171       $theImageBottom=isset($_COOKIE['theImageBottom'])?$_COOKIE['theImageBottom']:0;
    138        $windowWidth=$_COOKIE['windowWidth'] ;
    139        $windowHeight=$_COOKIE['windowHeight'] ;
     172
    140173
    141174       $theImageMargeWidth=isset($_COOKIE['theImageMargeWidth']) ? $_COOKIE['theImageMargeWidth']:0;
     
    143176
    144177      $theImageMargeHeight -= 2;
    145  
    146178if(isset($_COOKIE['theImageWidth'])){
    147179       $theImageWidth=    $_COOKIE['theImageWidth'];
    148180       $theImageHeight=  $_COOKIE['theImageHeight'] ;
    149181}
    150 
    151182       $theImageWidth=    $windowWidth -  $theImageLeft - $theImageMargeWidth;
    152183       $theImageHeight=   $windowHeight - $theImageTop  - $theImageMargeHeight ;
    153184 
    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
    156193    $theMainImageSize = $retour->get_size();
     194    $theMainImageWidth=   isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']:$theMainImageSize[0];
     195    $theMainImageHeight=   isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$theMainImageSize[1] ;
     196
    157197  if($theImageHeight!=0 && $theImageWidth!=0){
    158198      $pictureDeriv=$retour->type ;
     
    160200      $pictureDeriv=$default_size;
    161201   }
     202}
    162203//============================================================
    163204  pwg_set_session_var('picture_deriv',$pictureDeriv);
     
    229270//=====================================================================
    230271  global  $has_pamoorama,$pictureSelType,$pictureDeriv;
    231  
    232272  global $DEBUG_autosize;
     273  if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "init2, ";} ;
    233274   global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
    234275
     
    242283
    243284$pattern =Array('/width=\"(\d+)\"/','/height=\"(\d+)\"/');
    244  
    245 
    246285$replacement = Array('',"style='height:".$theImageHeight."px'");
    247286$content= preg_replace($pattern, $replacement, $content);
    248 
    249287if( $has_pamoorama=="true") return $content ;
    250288
    251289if( !preg_match("|c1|", $DEBUG_autosize, $val) ) return $content ;
    252290
    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 >";
    257293   echo "theImageWidth :" . $theImageWidth . " X " . $theImageHeight . "<br >";
    258    echo "theMainImageSize :" . $theMainImageSize[0]." > ".  $theMainImageSize[1] ."<br />";
     294
     295   echo $infos_message."<br />";
    259296   
    260297   $Ratio = $theMainImageSize[0]/$theMainImageSize[1];
     
    360397    global $pictureSelType,$pictureDeriv,$infos_message,$conf;
    361398    global $DEBUG_autosize;
    362  
     399 if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_1, " ;} ;
    363400    $ma_page=isset($page['body_id'])?$page['body_id']:"" ; 
    364401    if ($ma_page !='thePicturePage') return ;
     
    427464     global  $has_pamoorama;
    428465     global $DEBUG_autosize;
    429 
     466  if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_2, ";} ;
    430467    $ma_page=isset($page['body_id'])?$page['body_id']:"" ;   
    431468    if ($ma_page !='thePicturePage') return ; 
     
    468505    global  $has_pamoorama,$template,$page,$infos_message;
    469506     global $DEBUG_autosize;
    470 
     507      if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .= "cl_autosize_script_3, ";} ;
    471508$ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    472509if ($ma_page !='thePicturePage') return ; 
     
    521558    global  $has_pamoorama,$pictureSelType,$pictureDeriv;
    522559     global $DEBUG_autosize;
     560      if(preg_match("|event|", $DEBUG_autosize, $val)) { $infos_message .=  "cl_autosize_affiche, " ;} ;
     561
    523562$ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    524563if ($ma_page !='thePicturePage') return ; 
     
    528567    if(isset($set_miniature)){
    529568       
    530           $set_miniature = autosize_controler::cl_autosize_nofile($set_miniature) ;
     569          $set_miniature = self::cl_autosize_nofile($set_miniature) ;
    531570                     $template->append('footer_elements',$set_miniature); 
    532571      }
     
    781820 global $liste_type,$img_all,$set_miniature,$template,$infos_message,$error_message,$has_pamoorama ;
    782821 global $theImageWidth,$theImageHeight,$pictureSelType,$pictureDeriv ;
     822   global $DEBUG_autosize;
     823 
     824
    783825    $current = $template->get_template_vars('current');
    784826    $liste_type="";
     
    831873                  $No_files[$img_type] =   $img_select ;
    832874                  $nofile++ ;   
     875                   if(preg_match("|get_infos|", $DEBUG_autosize, $val))
     876                  $infos_message .=$nofile ." " ;
    833877            }         
     878             if(preg_match("|get_minfos|", $DEBUG_autosize, $val))
     879            $infos_message .=$img_url . " -> " . $img_type ."<br >";
     880
    834881          if(file_exists(PHPWG_ROOT_PATH.$img_url)){    } // if file       
    835882                             
     
    901948 
    902949          $retour=(object)'' ;
     950
     951
     952         
     953
    903954      if ($pictureSelType=="Autosize") $retour= $maxi_image ;
    904955      else if ($pictureSelType=="SelMaxi") $retour= $mini_image ;
     956
    905957      else  $retour=$last_image ;
    906958        if (!isset( $retour->type)){
     
    921973      if($retour->type=="Original")
    922974        $retour->type=$last_derivative ;
     975
     976    if(preg_match("|get_minfos|", $DEBUG_autosize, $val))
     977            $infos_message .=$pictureSelType . " -> " . $retour->type . " : "  . $retour->url  ."<br >";
     978
    923979return $retour ;
    924980
     
    10031059
    10041060                $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');
    10061062                $autosize_parametres =  cl_autosize_Set_Options();
    10071063                return $autosize_parametres;
  • extensions/Autosize/js/Affiche_script.js

    r18744 r18823  
    128128        nbf = jQuery("#theImage" + " " + type_src).length;
    129129        frm1 = jQuery("#theImage" + " " + type_src).get(0);
    130         Type_Img = "charlie";
     130        Type_Img = "iframe";
    131131
    132132        //'fb - xfbml - like - button
     
    145145          }
    146146        } else {
    147           jQuery(frm1).attr("id", "charlie");
     147          jQuery(frm1).attr("id", "iframe");
    148148        }
    149149
     
    307307      var aff_ok = false;
    308308      //=======================================================================
    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 });
    310311      infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
     312
    311313      if (infos_theMainImage.width == 0) {
    312314        if (Type_Img == "charlie") {
     
    314316          theMainImage_id = "charlie";
    315317          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);
    316328
    317329        } else if (Type_Img == "pamoorama") {
     
    407419          height: zheight,
    408420          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
    411433      /***********************************************************
    412434      *  RESIZE (une fois document chargé)
     
    901923    ***************************/
    902924    Autosize_resize = function (force, parametres) {
    903 
    904925      n = Get_dimensions(true, options);
    905 
    906926      if (n == false) return;
    907 
    908927      Save_cookies(options);
    909928      if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
     
    946965        //jQuery(theMainImage_id).height(Zone_image.image.height);
    947966      } else {
    948 
     967      if (options.imageAutosize==false)
    949968        if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
    950969          jQuery(theMainImage_id).height(Zone_image.image.height);
     
    955974          jQuery(theMainImage_id).width(Zone_image.image.width);
    956975        }
    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 });
    962984
    963985        }
     
    16851707      options.marge_top = Math.ceil(new_img.top - new_dim.top);
    16861708      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;
    16901709      if (options.theImageBottom < 0) {
    16911710        options.theImageBottom = 0;
    16921711      }
     1712      options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
     1713      options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
     1714
    16931715
    16941716
     
    17671789          break
    17681790
    1769 
     1791        case "iframe":
     1792          Zone_image.image.width = options.theImageWidth;
     1793          Zone_image.image.height = options.theImageHeight;
     1794          break
    17701795        case "pamoorama":
    17711796          Wait_pamoorama();
    17721797          break
    17731798      }
     1799
     1800
    17741801
    17751802      //=================================================
  • extensions/Autosize/main.inc.php

    r18731 r18823  
    22/*
    33Plugin Name: AutoSize
    4 Version: 2.11.0
     4Version: 2.11.1
    55Description: Ajuste l'affichage des photos en fonction de la hauteur de la fenetre de navigation
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=448
     
    3030        include_once(AUTOSIZE_PATH.'autosize.inc.php');
    3131//==================================================================
    32 global $page,$autosize_controler;
     32global $page,$autosize_ctrl;
    3333if (!isset( $page['start'])) {
    3434 $page['start']=0;
    3535 }
    36 $autosize_controler = new autosize_controler();
    37 add_event_handler('get_admin_plugin_menu_links', array(&$autosize_controler,'cl_autosize_admin')  );
     36$autosize_ctrl = new autosize_ctrl();
     37add_event_handler('get_admin_plugin_menu_links', array(&$autosize_ctrl,'cl_autosize_admin')  );
    3838
     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}
     47if(!preg_match("|NO|", $DEBUG_autosize, $val)) { 
    3948
    4049// 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
     52add_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'),EVENT_HANDLER_PRIORITY_NEUTRAL-11,2);
     53
    4354/**/
    44 add_event_handler('render_element_content',  array(&$autosize_controler,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
    45 add_event_handler('render_element_content',  array(&$autosize_controler,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2  );
    46 add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_1') );
    47 add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_script_2')  );
    48 add_event_handler('loc_after_page_header',array(&$autosize_controler, 'cl_autosize_script_3')  );
    49 add_event_handler('loc_after_page_header', array(&$autosize_controler, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21    );
     55add_event_handler('render_element_content',  array(&$autosize_ctrl,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
     56add_event_handler('render_element_content',  array(&$autosize_ctrl,'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2  );
     57add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_1') );
     58add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_script_2')  );
     59add_event_handler('loc_after_page_header',array(&$autosize_ctrl, 'cl_autosize_script_3')  );
     60add_event_handler('loc_after_page_header', array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21    );
    5061}
     62} ;
    5163
    5264
Note: See TracChangeset for help on using the changeset viewer.