aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--picture.php47
1 files changed, 22 insertions, 25 deletions
diff --git a/picture.php b/picture.php
index d88e6e262..d993fe3f2 100644
--- a/picture.php
+++ b/picture.php
@@ -671,36 +671,33 @@ SELECT *
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'],
+ )
+ );
- if (!empty($formats))
+ foreach ($formats as &$format)
{
- // 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'],
- )
- );
+ if (!isset($format['download_url']))
+ {
+ $format['download_url'] = 'action.php?format='.$format['format_id'].'&download';
+ }
- foreach ($formats as &$format)
+ $format['label'] = strtoupper($format['ext']);
+ $lang_key = 'format '.strtoupper($format['ext']);
+ if (isset($lang[$lang_key]))
{
- 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);
+ $format['label'] = $lang[$lang_key];
}
+
+ $format['filesize'] = sprintf('%.1fMB', $format['filesize']/1024);
}
$template->append('current', array('formats' => $formats), true);