Skip to content

Commit

Permalink
feature 2633 added: ability to select default size
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@15299 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed May 24, 2012
1 parent dcd6efb commit b205058
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/config_default.inc.php
Expand Up @@ -760,4 +760,7 @@
$conf['derivative_url_style']=0;

$conf['chmod_value']= substr_compare(PHP_SAPI, 'apa', 0, 3)==0 ? 0777 : 0755;

// 'small', 'medium' or 'large'
$conf['derivative_default_size'] = 'medium';
?>
18 changes: 15 additions & 3 deletions picture.php
Expand Up @@ -149,6 +149,8 @@
// this is the default handler that generates the display for the element
function default_picture_content($content, $element_info)
{
global $conf;

if ( !empty($content) )
{// someone hooked us - so we skip;
return $content;
Expand All @@ -162,7 +164,7 @@ function default_picture_content($content, $element_info)
}
setcookie('picture_deriv', false, 0, cookie_path() );
}
$deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE);
$deriv_type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']);
$selected_derivative = $element_info['derivatives'][$deriv_type];

$unique_derivatives = array();
Expand Down Expand Up @@ -938,10 +940,20 @@ function default_picture_content($content, $element_info)
and $picture['next']['src_image']->is_original()
and strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome/') === false)
{
$template->assign('U_PREFETCH', $picture['next']['derivatives'][pwg_get_session_var('picture_deriv', IMG_LARGE)]->get_url() );
$template->assign(
'U_PREFETCH',
$picture['next']['derivatives'][pwg_get_session_var('picture_deriv', $conf['derivative_default_size'])]->get_url()
);
}

$template->assign('U_CANONICAL', make_picture_url( array('image_id'=>$picture['current']['id'], 'image_file'=>$picture['current']['file']) ) );
$template->assign(
'U_CANONICAL',
make_picture_url(
array(
'image_id' => $picture['current']['id'],
'image_file' => $picture['current']['file'])
)
);

// +-----------------------------------------------------------------------+
// | sub pages |
Expand Down

0 comments on commit b205058

Please sign in to comment.