diff options
author | plegall <plg@piwigo.org> | 2012-05-24 23:12:04 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2012-05-24 23:12:04 +0000 |
commit | b205058983481bdd90fc8e6ff7edac61332496df (patch) | |
tree | 90baccad4e1142416a15ae34af8a164953434b01 | |
parent | dcd6efb7fc72eb013954c7cfab1292402ef89a1d (diff) |
feature 2633 added: ability to select default size
git-svn-id: http://piwigo.org/svn/trunk@15299 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/config_default.inc.php | 3 | ||||
-rw-r--r-- | picture.php | 18 |
2 files changed, 18 insertions, 3 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php index b8ed8fa8e..640cd5609 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -760,4 +760,7 @@ $conf['upload_form_automatic_rotation'] = true; $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'; ?>
\ No newline at end of file diff --git a/picture.php b/picture.php index 44216f49d..649c54311 100644 --- a/picture.php +++ b/picture.php @@ -149,6 +149,8 @@ trigger_action('loc_begin_picture'); // 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; @@ -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(); @@ -938,10 +940,20 @@ if (isset($picture['next']) 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 | |