feature 2548 multisize - ability to choose displayed size on index page

-added some logs on i.php (configurable) to measure the perf

git-svn-id: http://piwigo.org/svn/trunk@12908 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices
2012-01-17 06:09:32 +00:00
parent b18e3c8a80
commit e693ef60cd
18 changed files with 183 additions and 55 deletions
+16 -33
View File
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
@@ -104,38 +104,21 @@ foreach ($pictures as $row)
array('start')
);
if (isset($nb_comments_of) )
if (isset($nb_comments_of))
{
$row['nb_comments'] = (int)@$nb_comments_of[$row['id']];
$row['NB_COMMENTS'] = $row['nb_comments'] = (int)@$nb_comments_of[$row['id']];
}
$name = get_picture_title($row);
$tpl_var = array(
'ID' => $row['id'],
$tpl_var = array_merge( $row, array(
'TN_SRC' => DerivativeImage::thumb_url($row),
'TN_ALT' => htmlspecialchars(strip_tags($name)),
'TN_TITLE' => get_thumbnail_title($row),
'URL' => $url,
'src_image' => new SrcImage($row),
) );
// Extra fields for usage in extra themes
'FILE_PATH' => $row['path'],
'FILE_POSTED' => $row['date_available'],
'FILE_CREATED' => $row['date_creation'],
'FILE_DESC' => $row['comment'],
'FILE_AUTHOR' => $row['author'],
'FILE_HIT' => $row['hit'],
'FILE_SIZE' => $row['filesize'],
'FILE_WIDTH' => $row['width'],
'FILE_HEIGHT' => $row['height'],
'FILE_METADATE' => $row['date_metadata_update'],
'FILE_HAS_HD' => $row['has_high'],
'FILE_HD_WIDTH' => $row['high_width'],
'FILE_HD_HEIGHT' => $row['high_height'],
'FILE_HD_FILESIZE' => $row['high_filesize'],
'FILE_RATING_SCORE' => $row['rating_score'],
);
if ($conf['index_new_icon'])
{
$tpl_var['icon_ts'] = get_icon($row['date_available']);
@@ -145,7 +128,7 @@ foreach ($pictures as $row)
{
$tpl_var['NB_HITS'] = $row['hit'];
}
switch ($page['section'])
{
case 'best_rated' :
@@ -162,22 +145,22 @@ foreach ($pictures as $row)
break;
}
}
$tpl_var['NAME'] = $name;
if (isset($row['nb_comments']))
{
$tpl_var['NB_COMMENTS'] = $row['nb_comments'];
}
$tpl_thumbnails_var[] = $tpl_var;
}
$template->assign('SHOW_THUMBNAIL_CAPTION', $conf['show_thumbnail_caption']);
$derivative_params = ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) );
$template->assign( array(
'derivative_params' =>$derivative_params,
'SHOW_THUMBNAIL_CAPTION' =>$conf['show_thumbnail_caption'],
) );
$tpl_thumbnails_var = trigger_event('loc_end_index_thumbnails', $tpl_thumbnails_var, $pictures);
$template->assign('thumbnails', $tpl_thumbnails_var);
$template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails');
unset($pictures, $selection, $tpl_thumbnails_var);
$template->clear_assign( array('thumbnails') );
pwg_debug('end include/category_default.inc.php');
?>
+4 -1
View File
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
@@ -467,6 +467,9 @@ $conf['template_combine_files'] = true;
// gives an empty value '' to deactivate
$conf['show_php_errors'] = E_ALL;
// enable log for i derivative script
$conf['enable_i_log'] = false;
// +-----------------------------------------------------------------------+
// | authentication |
// +-----------------------------------------------------------------------+
+3 -9
View File
@@ -100,8 +100,6 @@ final class DerivativeImage
public $src_image;
private $requested_type;
private $flags = 0;
private $params;
private $rel_path, $rel_url;
@@ -111,12 +109,10 @@ final class DerivativeImage
$this->src_image = $src_image;
if (is_string($type))
{
$this->requested_type = $type;
$this->params = ImageStdParams::get_by_type($type);
}
else
{
$this->requested_type = IMG_CUSTOM;
$this->params = $type;
}
@@ -125,14 +121,12 @@ final class DerivativeImage
static function thumb_url($infos)
{
$src_image = new SrcImage($infos);
self::build($src_image, ImageStdParams::get_by_type(IMG_THUMB), $rel_path, $rel_url);
return get_root_url().$rel_url;
return self::url(IMG_THUMB, $infos);
}
static function url($type, $infos)
{
$src_image = new SrcImage($infos);
$src_image = is_object($infos) ? $infos : new SrcImage($infos);
$params = is_string($type) ? ImageStdParams::get_by_type($type) : $type;
self::build($src_image, $params, $rel_path, $rel_url);
return get_root_url().$rel_url;
@@ -257,7 +251,7 @@ final class DerivativeImage
$size = $this->get_size();
if ($size)
{
return 'width="'.$size[0].'" height="'.$size[1].'"';
return 'width='.$size[0].' height='.$size[1];
}
}
+10
View File
@@ -315,6 +315,16 @@ final class DerivativeParams
return $scale_size != null ? $scale_size : $in_size;
}
function max_width()
{
return $this->sizing->ideal_size[0];
}
function max_height()
{
return $this->sizing->ideal_size[1];
}
function is_identity($in_size)
{
if ($in_size[0] > $this->sizing->ideal_size[0] or
+6 -1
View File
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
// | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
@@ -842,6 +842,11 @@ class PwgTemplateAdapter
$args = func_get_args();
return call_user_func_array('sprintf', $args );
}
function derivative_url($type, $img)
{
return DerivativeImage::url($type, $img);
}
}