Changeset 12908 for trunk/include


Ignore:
Timestamp:
Jan 17, 2012, 7:09:32 AM (12 years ago)
Author:
rvelices
Message:

feature 2548 multisize - ability to choose displayed size on index page
-added some logs on i.php (configurable) to measure the perf

Location:
trunk/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_default.inc.php

    r12887 r12908  
    33// | Piwigo - a PHP based photo gallery                                    |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
     5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
    66// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    77// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
     
    105105      );
    106106
    107   if (isset($nb_comments_of) )
     107  if (isset($nb_comments_of))
    108108  {
    109     $row['nb_comments'] = (int)@$nb_comments_of[$row['id']];
     109    $row['NB_COMMENTS'] = $row['nb_comments'] = (int)@$nb_comments_of[$row['id']];
    110110  }
    111111
    112112  $name = get_picture_title($row);
    113113
    114   $tpl_var = array(
    115     'ID' => $row['id'],
     114  $tpl_var = array_merge( $row, array(
    116115    'TN_SRC' => DerivativeImage::thumb_url($row),
    117116    'TN_ALT' => htmlspecialchars(strip_tags($name)),
    118117    'TN_TITLE' => get_thumbnail_title($row),
    119118    'URL' => $url,
     119    'src_image' => new SrcImage($row),
     120    ) );
    120121
    121     // Extra fields for usage in extra themes
    122     'FILE_PATH' => $row['path'],
    123     'FILE_POSTED' => $row['date_available'],
    124     'FILE_CREATED' => $row['date_creation'],
    125     'FILE_DESC' => $row['comment'],
    126     'FILE_AUTHOR' => $row['author'],
    127     'FILE_HIT' => $row['hit'],
    128     'FILE_SIZE' => $row['filesize'],
    129     'FILE_WIDTH' => $row['width'],
    130     'FILE_HEIGHT' => $row['height'],
    131     'FILE_METADATE' => $row['date_metadata_update'],
    132     'FILE_HAS_HD' => $row['has_high'],
    133     'FILE_HD_WIDTH' => $row['high_width'],
    134     'FILE_HD_HEIGHT' => $row['high_height'],
    135     'FILE_HD_FILESIZE' => $row['high_filesize'],
    136     'FILE_RATING_SCORE' => $row['rating_score'],
    137     );
    138  
    139122  if ($conf['index_new_icon'])
    140123  {
     
    146129    $tpl_var['NB_HITS'] = $row['hit'];
    147130  }
    148  
     131
    149132  switch ($page['section'])
    150133  {
     
    163146    }
    164147  }
    165  
     148
    166149  $tpl_var['NAME'] = $name;
    167 
    168   if (isset($row['nb_comments']))
    169   {
    170     $tpl_var['NB_COMMENTS'] = $row['nb_comments'];
    171   }
    172 
    173150  $tpl_thumbnails_var[] = $tpl_var;
    174151}
    175152
    176 $template->assign('SHOW_THUMBNAIL_CAPTION', $conf['show_thumbnail_caption']);
     153$derivative_params = ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) );
     154
     155$template->assign( array(
     156  'derivative_params' =>$derivative_params,
     157  'SHOW_THUMBNAIL_CAPTION' =>$conf['show_thumbnail_caption'],
     158    ) );
    177159$tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
    178160$template->assign('thumbnails', $tpl_thumbnails_var);
    179161
    180162$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
    181 
     163unset($pictures, $selection, $tpl_thumbnails_var);
     164$template->clear_assign( array('thumbnails') );
    182165pwg_debug('end include/category_default.inc.php');
    183166?>
  • trunk/include/config_default.inc.php

    r12802 r12908  
    33// | Piwigo - a PHP based photo gallery                                    |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
     5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
    66// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    77// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
     
    467467// gives an empty value '' to deactivate
    468468$conf['show_php_errors'] = E_ALL;
     469
     470// enable log for i derivative script
     471$conf['enable_i_log'] = false;
    469472
    470473// +-----------------------------------------------------------------------+
  • trunk/include/derivative.inc.php

    r12865 r12908  
    101101  public $src_image;
    102102
    103   private $requested_type;
    104 
    105103  private $flags = 0;
    106104  private $params;
     
    112110    if (is_string($type))
    113111    {
    114       $this->requested_type = $type;
    115112      $this->params = ImageStdParams::get_by_type($type);
    116113    }
    117114    else
    118115    {
    119       $this->requested_type = IMG_CUSTOM;
    120116      $this->params = $type;
    121117    }
     
    126122  static function thumb_url($infos)
    127123  {
    128     $src_image = new SrcImage($infos);
    129     self::build($src_image, ImageStdParams::get_by_type(IMG_THUMB), $rel_path, $rel_url);
    130     return get_root_url().$rel_url;
     124    return self::url(IMG_THUMB, $infos);
    131125  }
    132126
    133127  static function url($type, $infos)
    134128  {
    135     $src_image = new SrcImage($infos);
     129    $src_image = is_object($infos) ? $infos : new SrcImage($infos);
    136130    $params = is_string($type) ? ImageStdParams::get_by_type($type) : $type;
    137131    self::build($src_image, $params, $rel_path, $rel_url);
     
    258252    if ($size)
    259253    {
    260       return 'width="'.$size[0].'" height="'.$size[1].'"';
     254      return 'width='.$size[0].' height='.$size[1];
    261255    }
    262256  }
  • trunk/include/derivative_params.inc.php

    r12881 r12908  
    316316  }
    317317
     318  function max_width()
     319  {
     320    return $this->sizing->ideal_size[0];
     321  }
     322
     323  function max_height()
     324  {
     325    return $this->sizing->ideal_size[1];
     326  }
     327 
    318328  function is_identity($in_size)
    319329  {
  • trunk/include/template.class.php

    r12874 r12908  
    33// | Piwigo - a PHP based photo gallery                                    |
    44// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
     5// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
    66// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    77// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
     
    843843    return call_user_func_array('sprintf',  $args );
    844844  }
     845 
     846  function derivative_url($type, $img)
     847  {
     848    return DerivativeImage::url($type, $img);
     849  }
    845850}
    846851
Note: See TracChangeset for help on using the changeset viewer.