Changeset 18115


Ignore:
Timestamp:
Sep 21, 2012, 10:54:57 AM (12 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4, fix bug

Location:
extensions/Autosize
Files:
3 edited

Legend:

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

    r17545 r18115  
    3737 // header ('X-UA-Compatible: IE=Edge')  ;
    3838 global  $template,$version,$icon_path,$page,$picture,$conf;
    39 
    40    $current = $template->get_template_vars('current');
    41 
    42    $model=  $_COOKIE['picture_deriv'] ;
     39 
     40   $current = $template->get_template_vars('current'); 
    4341      $has_pamoorama=isset($template->files['pamooramics_content']);
    4442 //====================================================================   
    4543    $pictureDeriv = pwg_get_session_var('picture_deriv',$conf['derivative_default_size']);
    4644    $SRC_IMG="";
    47        $selected_derivative =  $current['derivatives'][$pictureDeriv];
    48         if (!isset($current['selected_derivative'])){ 
     45    if(isset($current['derivatives']['Autosize']))
     46       $_COOKIE['picture_deriv']="Autosize";
     47   if(isset( $_COOKIE['picture_deriv']))
     48      $model=  $_COOKIE['picture_deriv'] ;
     49   else
     50      $model= $pictureDeriv ;
     51
     52   $selected_derivative =  $current['derivatives'][$model];
     53   if (!isset($current['selected_derivative'])){ 
     54
     55   $_COOKIE['picture_deriv']="Autosize";
     56    $model=  $_COOKIE['picture_deriv'] ;
     57         $current['SelMaxi']=ImageStdParams::get_custom(900,900);
     58         $current['derivatives'][$model]=ImageStdParams::get_custom($_COOKIE['theImageWidth'], $_COOKIE['theImageHeight']);
     59
     60
     61$selected_derivative=$current['derivatives'][$model];
     62$selected_derivative->type="Autosize";
    4963          $template->append('current', array(
    5064                                        'selected_derivative' => $selected_derivative
     
    5367          $current = $template->get_template_vars('current');
    5468        }
    55 
     69 
    5670        if(isset($current['derivatives'][$model])) {
    5771            $selected_derivative =  $current['derivatives'][$model];
     
    6074            $current = $template->get_template_vars('current');
    6175        }
    62    
     76
    6377    return $content;
    6478
     
    8599    } 
    86100  $current = $template->get_template_vars('current');
    87                        if (!isset($current)) return ;
     101  if (!isset($current)) return ;
    88102//===============================================================
    89103    $derivative = $current['src_image'] ;
     
    95109    $picture['current']['image_url']=$SRC_IMG; 
    96110//===============================================================
    97 
     111 
    98112    $user_status = $user['status'] ;
    99113    $autosize_parametres = cl_autosize_Get_Options();
     
    130144        $model=$conf['derivative_default_size'] ; 
    131145    }
    132   $derivative=$current['derivatives'][$model] ; 
     146    $derivative=$current['derivatives'][$model] ; 
    133147    $img_all= $derivative->get_all($derivative->src_image);
    134148    $maxi_img="";
     
    143157
    144158   
    145     $window_width = pwg_get_session_var('theMainImageWidth',$imgSizeWH[0]);
     159   $window_width = pwg_get_session_var('theMainImageWidth',$imgSizeWH[0]);
    146160 $window_height =  pwg_get_session_var('theMainImageHeight',$imgSizeWH[1]);
    147161
    148  if (!isset($_COOKIE['theMainImageHeight']))    setcookie('theMainImageHeight', $window_height );
     162if (!isset($_COOKIE['theMainImageHeight']))    setcookie('theMainImageHeight', $window_height );
    149163if (!isset($_COOKIE['theMainImageWidth']))  setcookie('theMainImageWidth',$window_width);
    150164
    151   //  echo "<div style='background-color:black;color:white' >$select_type w: $window_width x h: $window_height  </div>";
     165//echo "<div style='background-color:black;color:white' >$select_type w: $window_width x h: $window_height  </div>";
    152166
    153167    $last_defined=ImageStdParams::get_defined_type_map();   
     168
    154169    foreach ($img_all as $img_select){
    155170            $img_type  =  $img_select->get_type();     
    156171            if ($img_type=="square" || $img_type=="thumb" ) continue ;
    157 
     172            if (!isset($last_img)) $last_img=$img_select;
    158173            $img_url  = $img_select->get_url();
    159174            $imgSizeWH  =  $img_select->get_size();     
  • extensions/Autosize/js/Affiche_script.js

    r17545 r18115  
    352352          width: infos_theImage.general.width,
    353353          height: zheight,
    354           margesWidth: infos_window.width - infos_theImage.width + (options.marge_droite + options.marge_gauche)
     354          margesWidth: infos_window.width - infos_theImage.width
    355355        }
    356356      }
     
    411411        infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre general
    412412        //=============================================================
     413        if (Zone_image.container.margesWidth) {
     414          Zone_image.container.width = infos_window.width - Zone_image.container.margesWidth;
     415        }
    413416        Zone_image.container = {
    414417          height: infos_window.height - (infos_theImage.top),
    415418          width: Zone_image.container.width,
    416           margesWidth: infos_window.width - infos_theImage.width
     419          margesWidth: Zone_image.container.margesWidth || infos_window.width - infos_theImage.width
    417420        };
    418421
     
    19541957    //_______________________ init_gen _______________________
    19551958
    1956   });                                                                                                                                                                                                                                        // ready
     1959  });                                                                                                                                                                                                                                          // ready
    19571960
    19581961
  • extensions/Autosize/main.inc.php

    r17680 r18115  
    22/*
    33Plugin Name: AutoSize
    4 Version: 2.06
     4Version: auto
    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
     
    2222
    2323
    24 
    2524//==================================================================
    2625        include(AUTOSIZE_PATH."include/constants.php");           
    2726        include_once(AUTOSIZE_PATH.'autosize.inc.php');
    2827//==================================================================
    29 global $page;
     28global $page,$autosize_controler;
    3029if (!isset( $page['start'])) {
    3130 $page['start']=0;
    3231 }
    33  
    34 global $autosize_controler;
    3532$autosize_controler = new autosize_controler();
    3633add_event_handler('get_admin_plugin_menu_links', array(&$autosize_controler,'cl_autosize_admin')  );
     
    4037
    4138
    42 add_event_handler('render_element_content',  array(&$autosize_controler,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL,2  );
     39add_event_handler('render_element_content',  array(&$autosize_controler,'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
    4340
    4441//avant pamooramics
Note: See TracChangeset for help on using the changeset viewer.