aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-01-05 22:06:21 +0000
committerrvelices <rv-github@modusoptimus.com>2012-01-05 22:06:21 +0000
commit34717c1391166b847e4236cb3e519dfd7b0cbbd1 (patch)
treede9b7c278e78bcef1214d482cd292e9092e3a257 /picture.php
parente64ab974df242b25ade46d9795294ae859060355 (diff)
feature 2548 multisize - improved picture.php display (original...) + code cleanup
git-svn-id: http://piwigo.org/svn/trunk@12855 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r--picture.php34
1 files changed, 19 insertions, 15 deletions
diff --git a/picture.php b/picture.php
index 57f4e9fed..7f5878e60 100644
--- a/picture.php
+++ b/picture.php
@@ -162,7 +162,8 @@ function default_picture_content($content, $element_info)
$deriv_type = pwg_get_session_var('picture_deriv', IMG_LARGE);
$selected_derivative = $element_info['derivatives'][$deriv_type];
- $available_derivatives = array();
+ $unique_derivatives = array();
+ $show_original = isset($element_info['element_url']);
$added = array();
foreach($element_info['derivatives'] as $type => $derivative)
{
@@ -170,14 +171,20 @@ function default_picture_content($content, $element_info)
if (isset($added[$url]))
continue;
$added[$url] = 1;
- $available_derivatives[] = $type;
+ $show_original &= !($derivative->same_as_source());
+ $unique_derivatives[$type]= $derivative;
}
- global $user, $page, $template;
+ global $page, $template;
+ if ($show_original)
+ {
+ $template->assign( 'U_ORIGINAL', $element_info['element_url'] );
+ }
+
$template->append('current', array(
'selected_derivative' => $selected_derivative,
- 'available_derivative_types' => $available_derivatives,
+ 'unique_derivatives' => $unique_derivatives,
), true);
@@ -491,27 +498,24 @@ while ($row = pwg_db_fetch_assoc($result))
$i = 'current';
}
-
-
- $row['derivatives'] = DerivativeImage::get_all($row);
- $row['src_image'] = $row['derivatives'][IMG_THUMB]->src_image;
+ $row['src_image'] = new SrcImage($row);
+ $row['derivatives'] = DerivativeImage::get_all($row['src_image']);
- // ------ build element_path and element_url
- $row['element_path'] = get_element_path($row);
- $row['element_url'] = get_element_url($row);
-
if ($i=='current')
{
+ $row['element_path'] = get_element_path($row);
+
if ( $row['src_image']->is_original() )
- {
+ {// we have a photo
if ( $user['enabled_high']=='true' )
{
- $row['download_url'] = get_download_url('e',$row);
+ $row['element_url'] = $row['src_image']->get_url();
+ $row['download_url'] = get_action_url($row['id'], 'e', true);
}
}
else
{ // not a pic - need download link
- $row['download_url'] = $row['element_url'];
+ $row['download_url'] = $row['element_url'] = get_element_url($row);;
}
}