Changeset 18127


Ignore:
Timestamp:
Sep 22, 2012, 11:46:42 AM (8 years ago)
Author:
cljosse
Message:

[extensions] Autosize fix compatibility with 2.4, fix bug

Location:
extensions/Autosize
Files:
4 edited

Legend:

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

    r18115 r18127  
    3838 global  $template,$version,$icon_path,$page,$picture,$conf;
    3939 
    40    $current = $template->get_template_vars('current'); 
    41       $has_pamoorama=isset($template->files['pamooramics_content']);
    42  //====================================================================   
    43     $pictureDeriv = pwg_get_session_var('picture_deriv',$conf['derivative_default_size']);
    44     $SRC_IMG="";
    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";
    63           $template->append('current', array(
    64                                         'selected_derivative' => $selected_derivative
    65                                             ),
    66                              true);
    67           $current = $template->get_template_vars('current');
    68         }
    69  
    70         if(isset($current['derivatives'][$model])) {
    71             $selected_derivative =  $current['derivatives'][$model];
    72             $template->assign('current[selected_derivative]', $selected_derivative
    73                               , true);
    74             $current = $template->get_template_vars('current');
    75         }
    76 
    77     return $content;
     40$current = $template->get_template_vars('current'); 
     41  $has_pamoorama=isset($template->files['pamooramics_content']);
     42//====================================================================   
     43$pictureDeriv = pwg_get_session_var('picture_deriv',$conf['derivative_default_size']);
     44$SRC_IMG="";
     45if(isset($current['derivatives']['Autosize']))
     46    $_COOKIE['picture_deriv']="Autosize";
     47if(isset( $_COOKIE['picture_deriv']))
     48  $model=  $_COOKIE['picture_deriv'] ;
     49else
     50  $model= $pictureDeriv ;
     51
     52$selected_derivative =  $current['derivatives'][$model];
     53if (!isset($current['selected_derivative'])){ 
     54  $_COOKIE['picture_deriv']="Autosize";
     55  $model=  $_COOKIE['picture_deriv'] ;
     56  $current['SelMaxi']=ImageStdParams::get_custom(900,900);
     57  $current['derivatives'][$model]=ImageStdParams::get_custom($_COOKIE['theImageWidth'], $_COOKIE['theImageHeight']);
     58  $selected_derivative=$current['derivatives'][$model];
     59  $selected_derivative->type="Autosize";
     60  $template->append('current', array(
     61                                'selected_derivative' => $selected_derivative
     62                                    ),
     63                      true);
     64  $current = $template->get_template_vars('current');
     65  }
     66 
     67  if(isset($current['derivatives'][$model])) {
     68    $selected_derivative =  $current['derivatives'][$model];
     69    $template->assign('current[selected_derivative]', $selected_derivative , true);
     70    $current = $template->get_template_vars('current');
     71  }
     72
     73return $content;
    7874
    7975}//INIT
     
    171167            if ($img_type=="square" || $img_type=="thumb" ) continue ;
    172168            if (!isset($last_img)) $last_img=$img_select;
     169           
    173170            $img_url  = $img_select->get_url();
    174171            $imgSizeWH  =  $img_select->get_size();     
     172
    175173            if($img_type=="Autosize" || $img_type=="SelMaxi"){
    176174                $img_url = $img_select->src_image->get_url();
     
    178176                $liste_type[$img_type]=$img_type.",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
    179177            }else{
    180             $liste_type[$img_type]=$img_type.",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
    181             if ($img_type=="Original"){
    182          
    183             break ;
     178              $liste_type[$img_type]=$img_type.",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
     179              if ($img_type=="Original"){   
     180                          $maxi_img=  $img_type;
     181                          $maxi_url= $img_url;
     182                          $maxi_i=$img_select;     
     183                break ;
     184
     185
    184186            }
    185187           
     
    235237            pwg_set_session_var('picture_deriv', $_COOKIE['picture_deriv']);
    236238        }else{
    237         echo "<pre>".$_COOKIE['picture_deriv']. "No exist  " ;
     239       /* echo "<pre>".$_COOKIE['picture_deriv']. "No exist  " ;
    238240        print_r($img_all );
    239241        die();
     242        */
    240243        }
    241244    setcookie('picture_deriv', false, 0, cookie_path() );
     
    262265
    263266 if ('kardon' == $user['theme'] and isset($_GET['slideshow'])) return ;
     267     if ('stripped' == $user['theme'] ) return ;
     268
    264269                load_language('plugin.lang', AUTOSIZE_PATH);
    265270                $AUTOSIZE_PATH = dirname(__FILE__).'/';
     
    318323        return $template->parse( 'autosize_content', false);
    319324                                  }
    320                 }
     325                } 
    321326
    322327        } //public function cl_autosize_affiche
     
    335340    $has_pamoorama=isset($template->files['pamooramics_content']);
    336341  if (!$has_pamoorama) return ;
     342      if ('stripped' == $user['theme'] ) return ;
    337343
    338344    $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) );
     
    372378     global  $has_pamoorama;
    373379       if (!$has_pamoorama) return ;
    374      
     380       if ('stripped' == $user['theme'] ) return ;
     381
    375382                        $AUTOSIZE_PATH = dirname(__FILE__).'/';
    376383//================================================================
  • extensions/Autosize/js/Affiche_script.js

    r18115 r18127  
    443443      marges_llgbo = 0;
    444444      //==========================================================================================
    445 
     445       
    446446      init_gen();
    447447      jQuery(window).resize();
  • extensions/Autosize/main.inc.php

    r18115 r18127  
    22/*
    33Plugin Name: AutoSize
    4 Version: auto
     4Version: 2.08
    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
    77Author: cljosse
    88Author URI:http://cljosse.free.fr
    9 */
     9*/ 
    1010
    1111if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
  • extensions/Autosize/maintain.inc.php

    r17503 r18127  
    5959 function plugin_deactivate(){
    6060 global $conf ;
     61 
    6162 if (isset($conf['cl_derivatives_sav']))  {   
    6263    $arr = @unserialize($conf['cl_derivatives_sav']);         
    6364      if(isset($arr['d'])){
     65      $conf['derivatives'] = $conf['cl_derivatives_sav'];
    6466        $query = '
    6567                UPDATE '.CONFIG_TABLE.'
     
    7274     pwg_query($q);
    7375       }
    74     }     
     76    }   
     77      $model= $conf['derivative_default_size'];
     78      $_COOKIE  ['picture_deriv'] = $model;
     79      $_COOKIE ['picture_map'] = $model;
     80      pwg_set_session_var('picture_deriv', $model);
     81   
    7582 }
    7683
Note: See TracChangeset for help on using the changeset viewer.