aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-22 19:04:00 +0100
committerplegall <plg@piwigo.org>2015-12-22 19:04:00 +0100
commite439de1612eb471571c5a1503fba7f6531a90c08 (patch)
treebcd94ff458d11883a33008a7a66fdad8447e0ee1
parent6e2a4495bfa576fc1c08ed1ec586d6eb4a4ad5d8 (diff)
feature #379, multiple format, consider the original as a format
-rw-r--r--picture.php17
-rw-r--r--themes/default/template/picture.tpl1
2 files changed, 15 insertions, 3 deletions
diff --git a/picture.php b/picture.php
index 75b7cdaf2..d88e6e262 100644
--- a/picture.php
+++ b/picture.php
@@ -674,10 +674,23 @@ SELECT *
if (!empty($formats))
{
+ // 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)
{
- $format['download_url'] = 'action.php?format='.$format['format_id'];
- $format['download_url'].= '&amp;download';
+ if (!isset($format['download_url']))
+ {
+ $format['download_url'] = 'action.php?format='.$format['format_id'].'&amp;download';
+ }
$format['label'] = strtoupper($format['ext']);
$lang_key = 'format '.strtoupper($format['ext']);
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 3cccf6b29..bfc0c2498 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -81,7 +81,6 @@ jQuery().ready(function() {
<div id="downloadSwitchBox" class="switchBox">
<div class="switchBoxTitle">{'Download'|translate} - {'Formats'|translate}</div>
<ul>
- <li><a href="{$current.U_DOWNLOAD}" rel="nofollow">{'Original'|@translate}</a></li>
{foreach from=$current.formats item=format}
<li><a href="{$format.download_url}" rel="nofollow">{$format.label}<span class="downloadformatDetails"> ({$format.filesize})</span></a></li>
{/foreach}