aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/category_default.inc.php49
-rw-r--r--include/config_default.inc.php5
-rw-r--r--include/derivative.inc.php12
-rw-r--r--include/derivative_params.inc.php10
-rw-r--r--include/template.class.php7
5 files changed, 39 insertions, 44 deletions
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 8d2cd050b..18a4cb4bf 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -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_var['NAME'] = $name;
$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');
?> \ No newline at end of file
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index c1329b96f..dad6e9b20 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -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 |
// +-----------------------------------------------------------------------+
diff --git a/include/derivative.inc.php b/include/derivative.inc.php
index d15e7eff3..1f5152dd3 100644
--- a/include/derivative.inc.php
+++ b/include/derivative.inc.php
@@ -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];
}
}
diff --git a/include/derivative_params.inc.php b/include/derivative_params.inc.php
index 569c4ace1..30497639f 100644
--- a/include/derivative_params.inc.php
+++ b/include/derivative_params.inc.php
@@ -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
diff --git a/include/template.class.php b/include/template.class.php
index b6d1aa4ba..7bcab1150 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -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);
+ }
}