aboutsummaryrefslogtreecommitdiffstats
path: root/picture.php
diff options
context:
space:
mode:
Diffstat (limited to 'picture.php')
-rw-r--r--picture.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/picture.php b/picture.php
index 94c2b3ea3..d993fe3f2 100644
--- a/picture.php
+++ b/picture.php
@@ -662,6 +662,46 @@ foreach (array('first','previous','next','last', 'current') as $which_image)
if ($conf['picture_download_icon'] and !empty($picture['current']['download_url']))
{
$template->append('current', array('U_DOWNLOAD' => $picture['current']['download_url']), true);
+
+ if ($conf['enable_formats'])
+ {
+ $query = '
+SELECT *
+ FROM '.IMAGE_FORMAT_TABLE.'
+ WHERE image_id = '.$picture['current']['id'].'
+;';
+ $formats = query2array($query);
+
+ // let's add the original as a format among others. It will just have a
+ // specific download URL
+ array_unshift(
+ $formats,
+ array(
+ 'download_url' => $picture['current']['download_url'],
+ 'ext' => get_extension($picture['current']['file']),
+ 'filesize' => $picture['current']['filesize'],
+ )
+ );
+
+ foreach ($formats as &$format)
+ {
+ if (!isset($format['download_url']))
+ {
+ $format['download_url'] = 'action.php?format='.$format['format_id'].'&download';
+ }
+
+ $format['label'] = strtoupper($format['ext']);
+ $lang_key = 'format '.strtoupper($format['ext']);
+ if (isset($lang[$lang_key]))
+ {
+ $format['label'] = $lang[$lang_key];
+ }
+
+ $format['filesize'] = sprintf('%.1fMB', $format['filesize']/1024);
+ }
+
+ $template->append('current', array('formats' => $formats), true);
+ }
}