aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-01-17 21:58:18 +0000
committerrvelices <rv-github@modusoptimus.com>2012-01-17 21:58:18 +0000
commitcc01941ed97f6c8f6790931bfc167ba45c5a8f91 (patch)
treefe465d457c034efba03cfe26d65b5467d88bfca2
parente1bd64fdfc50f3ef50c0b4391c4586bbaeacb287 (diff)
feature 2548 multisize - code cleanup + better usage in category_cats + i.php logs memory usage peak
git-svn-id: http://piwigo.org/svn/trunk@12920 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--i.php14
-rw-r--r--include/category_cats.inc.php33
-rw-r--r--include/category_default.inc.php11
-rw-r--r--include/common.inc.php6
-rw-r--r--include/functions.inc.php69
-rw-r--r--include/functions_html.inc.php70
-rw-r--r--include/functions_picture.inc.php23
-rw-r--r--include/template.class.php26
-rw-r--r--install.php1
-rw-r--r--picture.php38
-rw-r--r--themes/default/template/mainpage_categories.tpl10
-rw-r--r--themes/default/template/thumbnails.tpl16
-rw-r--r--themes/default/theme.css1
-rw-r--r--upgrade.php1
14 files changed, 150 insertions, 169 deletions
diff --git a/i.php b/i.php
index 1911d77ab..225c087a0 100644
--- a/i.php
+++ b/i.php
@@ -28,13 +28,6 @@ include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/');
defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
-function get_moment()
-{
- $t1 = explode( ' ', microtime() );
- $t2 = explode( '.', $t1[0] );
- $t2 = $t1[1].'.'.$t2[1];
- return $t2;
-}
function trigger_action() {}
function get_extension( $filename )
{
@@ -127,7 +120,7 @@ function ierror($msg, $code)
function time_step( &$step )
{
$tmp = $step;
- $step = get_moment();
+ $step = microtime(true);
return intval(1000*($step - $tmp));
}
@@ -263,7 +256,7 @@ function send_derivative($expires)
$page=array();
-$begin = $step = get_moment();
+$begin = $step = microtime(true);
$timing=array();
foreach( explode(',','load,rotate,crop,scale,sharpen,watermark,save,send') as $k )
{
@@ -414,6 +407,7 @@ $timing['send'] = time_step($step);
ilog('perf',
basename($page['src_path']), $o_size, $o_size[0]*$o_size[1],
basename($page['derivative_path']), $d_size, $d_size[0]*$d_size[1],
+ function_exists('memory_get_peak_usage') ? round( memory_get_peak_usage()/(1024*1024), 1) : '',
time_step($begin),
- $timing);
+ '|', $timing);
?> \ No newline at end of file
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 2ecdf5ec2..cce9ac520 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -189,7 +189,6 @@ SELECT *
{
if ($row['level'] <= $user['level'])
{
- $row['tn_src'] = DerivativeImage::thumb_url($row);
$infos_of_image[$row['id']] = $row;
}
else
@@ -236,10 +235,15 @@ SELECT *
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
{
- $row['tn_src'] = DerivativeImage::thumb_url($row);
$infos_of_image[$row['id']] = $row;
}
}
+
+ foreach ($infos_of_image as &$info)
+ {
+ $info['src_image'] = new SrcImage($info);
+ }
+ unset($info);
}
if (count($user_representative_updates_for))
@@ -311,7 +315,7 @@ if (count($categories) > 0)
$tpl_var =
array(
'ID' => $category['id'],
- 'TN_SRC' => $representative_infos['tn_src'],
+ 'representative' => $representative_infos,
'TN_ALT' => strip_tags($category['name']),
'URL' => make_index_url(
@@ -333,23 +337,6 @@ if (count($categories) > 0)
@$category['comment'],
'subcatify_category_description')),
'NAME' => $name,
-
- // Extra fields for usage in extra themes
- 'FILE_PATH' => $representative_infos['path'],
- 'FILE_POSTED' => $representative_infos['date_available'],
- 'FILE_CREATED' => $representative_infos['date_creation'],
- 'FILE_DESC' => $representative_infos['comment'],
- 'FILE_AUTHOR' => $representative_infos['author'],
- 'FILE_HIT' => $representative_infos['hit'],
- 'FILE_SIZE' => $representative_infos['filesize'],
- 'FILE_WIDTH' => $representative_infos['width'],
- 'FILE_HEIGHT' => $representative_infos['height'],
- 'FILE_METADATE' => $representative_infos['date_metadata_update'],
- 'FILE_HAS_HD' => $representative_infos['has_high'],
- 'FILE_HD_WIDTH' => $representative_infos['high_width'],
- 'FILE_HD_HEIGHT' => $representative_infos['high_height'],
- 'FILE_HD_FILESIZE' => $representative_infos['high_filesize'],
- 'FILE_RATING_SCORE' => $representative_infos['rating_score'],
);
if ($conf['index_new_icon'])
{
@@ -387,8 +374,12 @@ if (count($categories) > 0)
$tpl_thumbnails_var[] = $tpl_var;
}
+ $derivative_params = trigger_event('get_index_album_derivative_params', ImageStdParams::get_by_type(IMG_SMALL) );
$tpl_thumbnails_var = trigger_event('loc_end_index_category_thumbnails', $tpl_thumbnails_var, $categories);
- $template->assign( 'category_thumbnails', $tpl_thumbnails_var);
+ $template->assign( array(
+ 'category_thumbnails' => $tpl_thumbnails_var,
+ 'derivative_params' => $derivative_params,
+ ) );
$template->assign_var_from_handle('CATEGORIES', 'index_category_thumbnails');
}
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 18a4cb4bf..454d1e1e5 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -109,13 +109,15 @@ foreach ($pictures as $row)
$row['NB_COMMENTS'] = $row['nb_comments'] = (int)@$nb_comments_of[$row['id']];
}
- $name = get_picture_title($row);
+ $name = render_element_name($row);
+ $desc = render_element_description($row);
$tpl_var = array_merge( $row, array(
'TN_SRC' => DerivativeImage::thumb_url($row),
'TN_ALT' => htmlspecialchars(strip_tags($name)),
- 'TN_TITLE' => get_thumbnail_title($row),
+ 'TN_TITLE' => get_thumbnail_title($row, $name, $desc),
'URL' => $url,
+ 'DESCRIPTION' => $desc,
'src_image' => new SrcImage($row),
) );
@@ -145,12 +147,11 @@ foreach ($pictures as $row)
break;
}
}
-
$tpl_var['NAME'] = $name;
$tpl_thumbnails_var[] = $tpl_var;
}
-$derivative_params = ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) );
+$derivative_params = trigger_event('get_index_derivative_params', ImageStdParams::get_by_type( pwg_get_session_var('index_deriv', IMG_THUMB) ) );
$template->assign( array(
'derivative_params' =>$derivative_params,
@@ -161,6 +162,6 @@ $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') );
+$template->clear_assign( array('thumbnails', 'derivative_params') );
pwg_debug('end include/category_default.inc.php');
?> \ No newline at end of file
diff --git a/include/common.inc.php b/include/common.inc.php
index 093aca08a..811a4a650 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -24,9 +24,7 @@
defined('PHPWG_ROOT_PATH') or trigger_error('Hacking attempt!', E_USER_ERROR);
// determine the initial instant to indicate the generation time of this page
-$t1 = explode( ' ', microtime() );
-$t2 = explode( '.', $t1[0] );
-$t2 = $t1[1].'.'.$t2[1];
+$t2 = microtime(true);
@set_magic_quotes_runtime(0); // Disable magic_quotes_runtime
@@ -109,7 +107,7 @@ if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors']))
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
-include(PHPWG_ROOT_PATH .'include/template.class.php');
+
// Database connection
try
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 4647e8845..5ea5432b6 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -33,6 +33,8 @@ include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/derivative_params.inc.php');
include_once( PHPWG_ROOT_PATH .'include/derivative_std_params.inc.php');
include_once( PHPWG_ROOT_PATH .'include/derivative.inc.php');
+require_once( PHPWG_ROOT_PATH .'include/smarty/libs/Smarty.class.php');
+include_once( PHPWG_ROOT_PATH .'include/template.class.php');
//----------------------------------------------------------- generic functions
@@ -52,10 +54,7 @@ function micro_seconds()
// are precised : e.g. 1052343429.89276600
function get_moment()
{
- $t1 = explode( ' ', microtime() );
- $t2 = explode( '.', $t1[0] );
- $t2 = $t1[1].'.'.$t2[1];
- return $t2;
+ return microtime(true);
}
// The function get_elapsed_time returns the number of seconds (with 3
@@ -663,7 +662,7 @@ function get_query_string_diff($rejects=array(), $escape=true)
{
return '';
}
-
+
$query_string = '';
$str = $_SERVER['QUERY_STRING'];
@@ -816,50 +815,6 @@ function get_thumbnail_location($element_info)
}
/**
- * returns the title of the thumbnail based on photo properties
- */
-function get_thumbnail_title($info)
-{
- global $conf, $user;
-
- $title = get_picture_title($info);
-
- $details = array();
-
- if (!empty($info['hit']))
- {
- $details[] = $info['hit'].' '.strtolower(l10n('Visits'));
- }
-
- if ($conf['rate'] and !empty($info['rating_score']))
- {
- $details[] = strtolower(l10n('Rating score')).' '.$info['rating_score'];
- }
-
- if (isset($info['nb_comments']) and $info['nb_comments'] != 0)
- {
- $details[] = l10n_dec('%d comment', '%d comments', $info['nb_comments']);
- }
-
- if (count($details) > 0)
- {
- $title.= ' ('.implode(', ', $details).')';
- }
-
- if (!empty($info['comment']))
- {
- $info['comment'] = trigger_event('render_element_description', $info['comment']);
- $title.= ' '.substr($info['comment'], 0, 100).(strlen($info['comment']) > 100 ? '...' : '');
- }
-
- $title = htmlspecialchars(strip_tags($title));
-
- $title = trigger_event('get_thumbnail_title', $title, $info);
-
- return $title;
-}
-
-/**
* fill the current user caddie with given elements, if not already in
* caddie
*
@@ -904,18 +859,6 @@ function get_name_from_file($filename)
}
/**
- */
-function get_picture_title($info)
-{
- if (isset($info['name']) and !empty($info['name']))
- {
- return trigger_event('render_element_description', $info['name']);
- }
-
- return get_name_from_file($info['file']);
-}
-
-/**
* returns the corresponding value from $lang if existing. Else, the key is
* returned
*
@@ -1435,8 +1378,8 @@ function get_ephemeral_key($valid_after_seconds, $aditionnal_data_to_hash = '')
$time = round(microtime(true), 1);
return $time.':'.$valid_after_seconds.':'
.hash_hmac(
- 'md5',
- $time.substr($_SERVER['REMOTE_ADDR'],0,5).$valid_after_seconds.$aditionnal_data_to_hash,
+ 'md5',
+ $time.substr($_SERVER['REMOTE_ADDR'],0,5).$valid_after_seconds.$aditionnal_data_to_hash,
$conf['secret_key']);
}
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index ce327cc0c..a546f6880 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.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 |
// +-----------------------------------------------------------------------+
@@ -178,7 +178,7 @@ SELECT id, name, permalink
<a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$cat['name'].'</a>';
}
}
-
+
if ($single_link and isset($single_url))
{
$output.= '</a>';
@@ -295,7 +295,7 @@ function name_compare($a, $b)
function tag_alpha_compare($a, $b)
{
global $page;
-
+
foreach (array($a, $b) as $tag)
{
if (!isset($page[__FUNCTION__.'_cache'][ $tag['name'] ]))
@@ -533,4 +533,68 @@ function register_default_menubar_blocks( $menu_ref_arr )
$menu->register_block( new RegisteredBlock( 'mbIdentification', 'Identification', 'piwigo') );
}
+/**
+ */
+function render_element_name($info)
+{
+ $name = $info['name'];
+ if (!empty($name))
+ {
+ $name = trigger_event('render_element_description', $name);
+ return $name;
+ }
+
+ return get_name_from_file($info['file']);
+}
+
+function render_element_description($info)
+{
+ $comment = $info['comment'];
+ if (!empty($comment))
+ {
+ $comment = trigger_event('render_element_description', $comment);
+ return $comment;
+ }
+ return '';
+}
+
+/**
+ * returns the title of the thumbnail based on photo properties
+ */
+function get_thumbnail_title($info, $title, $comment)
+{
+ global $conf, $user;
+
+ $details = array();
+
+ if (!empty($info['hit']))
+ {
+ $details[] = $info['hit'].' '.strtolower(l10n('Visits'));
+ }
+
+ if ($conf['rate'] and !empty($info['rating_score']))
+ {
+ $details[] = strtolower(l10n('Rating score')).' '.$info['rating_score'];
+ }
+
+ if (isset($info['nb_comments']) and $info['nb_comments'] != 0)
+ {
+ $details[] = l10n_dec('%d comment', '%d comments', $info['nb_comments']);
+ }
+
+ if (count($details) > 0)
+ {
+ $title.= ' ('.implode(', ', $details).')';
+ }
+
+ if (!empty($comment))
+ {
+ $title.= ' '.substr($info['comment'], 0, 100).(strlen($info['comment']) > 100 ? '...' : '');
+ }
+
+ $title = htmlspecialchars(strip_tags($title));
+ $title = trigger_event('get_thumbnail_title', $title, $info);
+ return $title;
+}
+
?> \ No newline at end of file
diff --git a/include/functions_picture.inc.php b/include/functions_picture.inc.php
index 85de60b14..aac3e45b1 100644
--- a/include/functions_picture.inc.php
+++ b/include/functions_picture.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 |
// +-----------------------------------------------------------------------+
@@ -22,25 +22,6 @@
// +-----------------------------------------------------------------------+
-
-/*
- * Returns the name of a photo according to its name and its filename.
- * @param name string
- * @param filename string
- * @return string
- */
-function get_image_name($name, $filename)
-{
- if (!empty($name))
- {
- return $name;
- }
- else
- {
- return get_name_from_file($filename);
- }
-}
-
/*
* @param element_info array containing element information from db;
* at least 'id', 'path', 'has_high' should be present
@@ -249,4 +230,4 @@ function get_picture_size( $original_width, $original_height,
return $picture_size;
}
-?>
+?> \ No newline at end of file
diff --git a/include/template.class.php b/include/template.class.php
index 7bcab1150..90d7d58b8 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -22,9 +22,6 @@
// +-----------------------------------------------------------------------+
-require_once(PHPWG_ROOT_PATH.'include/smarty/libs/Smarty.class.php');
-
-
class Template {
var $smarty;
@@ -42,6 +39,7 @@ class Template {
// used by html_head smarty block to add content before </head>
var $html_head_elements = array();
+ private $html_style = '';
const COMBINED_SCRIPTS_TAG = '<!-- COMBINED_SCRIPTS -->';
var $scriptLoader;
@@ -112,6 +110,7 @@ class Template {
$this->smarty->register_modifier( 'explode', array('Template', 'mod_explode') );
$this->smarty->register_modifier( 'get_extent', array(&$this, 'get_extent') );
$this->smarty->register_block('html_head', array(&$this, 'block_html_head') );
+ $this->smarty->register_block('html_style', array(&$this, 'block_html_style') );
$this->smarty->register_function('combine_script', array(&$this, 'func_combine_script') );
$this->smarty->register_function('get_combined_scripts', array(&$this, 'func_get_combined_scripts') );
$this->smarty->register_function('combine_css', array(&$this, 'func_combine_css') );
@@ -466,15 +465,21 @@ class Template {
$this->css_by_priority = array();
}
- if ( count($this->html_head_elements) )
+ if ( count($this->html_head_elements) || strlen($this->html_style) )
{
$search = "\n</head>";
$pos = strpos( $this->output, $search );
if ($pos !== false)
{
- $this->output = substr_replace( $this->output, "\n".implode( "\n", $this->html_head_elements ), $pos, 0 );
+ $rep = "\n".implode( "\n", $this->html_head_elements );
+ if (strlen($this->html_style))
+ {
+ $rep='<style type="text/css">'.$this->html_style.'</style>';
+ }
+ $this->output = substr_replace( $this->output, $rep, $pos, 0 );
} //else maybe error or warning ?
$this->html_head_elements = array();
+ $this->html_style = '';
}
echo $this->output;
@@ -532,6 +537,15 @@ class Template {
}
}
+ function block_html_style($params, $content, &$smarty, &$repeat)
+ {
+ $content = trim($content);
+ if ( !empty($content) )
+ { // second call
+ $this->html_style .= $content;
+ }
+ }
+
/**
* combine_script smarty function allows inclusion of a javascript file in the current page.
* The engine will combine several js files into a single one in order to reduce the number of
@@ -842,7 +856,7 @@ class PwgTemplateAdapter
$args = func_get_args();
return call_user_func_array('sprintf', $args );
}
-
+
function derivative_url($type, $img)
{
return DerivativeImage::url($type, $img);
diff --git a/install.php b/install.php
index 1209bcd4a..1a56e4553 100644
--- a/install.php
+++ b/install.php
@@ -224,7 +224,6 @@ if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<'))
}
//----------------------------------------------------- template initialization
-include( PHPWG_ROOT_PATH .'include/template.class.php');
$template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear');
$template->set_filenames( array('install' => 'install.tpl') );
if (!isset($step))
diff --git a/picture.php b/picture.php
index 1d35b9613..fd169575b 100644
--- a/picture.php
+++ b/picture.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 |
// +-----------------------------------------------------------------------+
@@ -176,7 +176,7 @@ function default_picture_content($content, $element_info)
}
global $page, $template;
-
+
if ($show_original)
{
$template->assign( 'U_ORIGINAL', $element_info['element_url'] );
@@ -312,10 +312,6 @@ UPDATE '.USER_CACHE_CATEGORIES_TABLE.'
break;
}
- case 'toggle_metadata' :
- {
- break;
- }
case 'add_to_caddie' :
{
fill_caddie(array($page['image_id']));
@@ -334,7 +330,7 @@ UPDATE '.USER_CACHE_CATEGORIES_TABLE.'
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID);
$author_id = get_comment_author_id($_GET['comment_to_edit']);
-
+
if (can_manage_comment('edit', $author_id))
{
if (!empty($_POST['content']))
@@ -364,7 +360,7 @@ UPDATE '.USER_CACHE_CATEGORIES_TABLE.'
default:
trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
}
-
+
if ($perform_redirect)
{
redirect($url_self);
@@ -500,7 +496,7 @@ while ($row = pwg_db_fetch_assoc($result))
$row['src_image'] = new SrcImage($row);
$row['derivatives'] = DerivativeImage::get_all($row['src_image']);
-
+
if ($i=='current')
{
$row['element_path'] = get_element_path($row);
@@ -530,18 +526,7 @@ while ($row = pwg_db_fetch_assoc($result))
);
$picture[$i] = $row;
-
- if ( !empty( $row['name'] ) )
- {
- $picture[$i]['name'] = $row['name'];
- }
- else
- {
- $file_wo_ext = get_filename_wo_extension($row['file']);
- $picture[$i]['name'] = str_replace('_', ' ', $file_wo_ext);
- }
-
- $picture[$i]['name'] = trigger_event('render_element_description', $picture[$i]['name']);
+ $picture[$i]['TITLE'] = render_element_name($row);
if ('previous'==$i and $page['previous_item']==$page['first_item'])
{
@@ -604,7 +589,7 @@ else
$template->set_filenames( array('picture' => 'picture.tpl'));
}
-$title = $picture['current']['name'];
+$title = $picture['current']['TITLE'];
$title_nb = ($page['current_rank'] + 1).'/'.count($page['items']);
// metadata
@@ -643,7 +628,6 @@ foreach (array('first','previous','next','last', 'current') as $which_image)
array_merge(
$picture[$which_image],
array(
- 'TITLE' => $picture[$which_image]['name'],
'THUMB_SRC' => $picture[$which_image]['derivatives'][IMG_THUMB]->get_url(),
// Params slideshow was transmit to navigation buttons
'U_IMG' =>
@@ -652,12 +636,12 @@ foreach (array('first','previous','next','last', 'current') as $which_image)
)
)
);
- if ($conf['picture_download_icon'] and !empty($picture['current']['download_url']))
- {
- $template->append($which_image, array('U_DOWNLOAD' => $picture['current']['download_url']), true);
- }
}
}
+if ($conf['picture_download_icon'] and !empty($picture['current']['download_url']))
+{
+ $template->append('current', array('U_DOWNLOAD' => $picture['current']['download_url']), true);
+}
if ($page['slideshow'])
diff --git a/themes/default/template/mainpage_categories.tpl b/themes/default/template/mainpage_categories.tpl
index 016c95558..15e8802d9 100644
--- a/themes/default/template/mainpage_categories.tpl
+++ b/themes/default/template/mainpage_categories.tpl
@@ -1,11 +1,19 @@
+{strip}{html_style}
+.thumbnailCategory DIV.illustration{ldelim}
+ width: {$derivative_params->max_width()+5}px;
+}
+.content .thumbnailCategory .description{ldelim}
+ height: {$derivative_params->max_height()+5}px;
+}
+{/html_style}{/strip}
<ul class="thumbnailCategories">
{foreach from=$category_thumbnails item=cat}
<li>
<div class="thumbnailCategory">
<div class="illustration">
<a href="{$cat.URL}">
- <img src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" title="{$cat.NAME|@replace:'"':' '|@strip_tags:false} - {'display this album'|@translate}">
+ <img src="{$pwg->derivative_url($derivative_params, $cat.representative.src_image)}" alt="{$cat.TN_ALT}" title="{$cat.NAME|@replace:'"':' '|@strip_tags:false} - {'display this album'|@translate}">
</a>
</div>
<div class="description">
diff --git a/themes/default/template/thumbnails.tpl b/themes/default/template/thumbnails.tpl
index fec76214e..e2d1e88c4 100644
--- a/themes/default/template/thumbnails.tpl
+++ b/themes/default/template/thumbnails.tpl
@@ -1,6 +1,5 @@
{if !empty($thumbnails)}{strip}
-{html_head}
-<style type="text/css">
+{html_style}
{*Set some sizes according to maximum thumbnail width and height*}
.thumbnails SPAN,
.thumbnails .wrap2 A,
@@ -11,9 +10,16 @@
.thumbnails .wrap2{ldelim}
height: {$derivative_params->max_height()+2}px;
}
-
-</style>
-{/html_head}
+{if $derivative_params->max_width() > 600}
+.thumbLegend {ldelim}font-size: 130%}
+{else}
+{if $derivative_params->max_width() > 400}
+.thumbLegend {ldelim}font-size: 110%}
+{else}
+.thumbLegend {ldelim}font-size: 90%}
+{/if}
+{/if}
+{/html_style}
{foreach from=$thumbnails item=thumbnail}
<li>
<span class="wrap1">
diff --git a/themes/default/theme.css b/themes/default/theme.css
index b8f919c43..0477d5a7d 100644
--- a/themes/default/theme.css
+++ b/themes/default/theme.css
@@ -263,7 +263,6 @@ TD.calDayHead {
/* Thumbnails */
.thumbnails SPAN.thumbLegend {
- font-size: 90%;
overflow: hidden;/* oversized legend is clipped */
}
diff --git a/upgrade.php b/upgrade.php
index d06c29205..189a56306 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -216,7 +216,6 @@ define('CURRENT_DATE', $dbnow);
// | template initialization |
// +-----------------------------------------------------------------------+
-include( PHPWG_ROOT_PATH .'include/template.class.php');
$template = new Template(PHPWG_ROOT_PATH.'admin/themes', 'clear');
$template->set_filenames(array('upgrade'=>'upgrade.tpl'));
$template->assign(array(