diff --git a/e107_plugins/gallery/admin_gallery.php b/e107_plugins/gallery/admin_gallery.php
index c7fc66b39..3c2d9132f 100644
--- a/e107_plugins/gallery/admin_gallery.php
+++ b/e107_plugins/gallery/admin_gallery.php
@@ -137,7 +137,8 @@ class gallery_cat_admin_ui extends e_admin_ui
protected $prefs = array(
'popup_w' => array('title'=> 'Image Max. Width', 'type' => 'text', 'data' => 'int', 'help'=>'Images will be auto-resized if greater than the width given here'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'popup_h' => array('title'=> 'Image Max. Height', 'type' => 'text', 'data' => 'int', 'help'=>'Images will be auto-resized if greater than the height given here'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
-
+
+ 'downloadable' => array('title'=> 'Show "download" link', 'type' => 'boolean', 'integer' => 'int', 'help'=>'A download option will be shown next to the popup caption'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'slideshow_category' => array('title'=> 'Slideshow category', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Images from this category will be used in the sliding menu.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
// 'slideshow_thumb_w' => array('title'=> 'Thumbnail Width', 'type' => 'number', 'data' => 'integer', 'help'=>'Width in px'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
diff --git a/e107_plugins/gallery/e_shortcode.php b/e107_plugins/gallery/e_shortcode.php
index dbd71aaf4..ba33d7788 100644
--- a/e107_plugins/gallery/e_shortcode.php
+++ b/e107_plugins/gallery/e_shortcode.php
@@ -18,6 +18,12 @@ class gallery_shortcodes extends e_shortcode
public $sliderCat = 1;
public $slideMode = FALSE;
public $slideCount = 1;
+ private $downloadable = FALSE;
+
+ function __construct()
+ {
+ $this->downloadable = e107::getPlugPref('gallery','downloadable');
+ }
function sc_gallery_caption($parm='')
{
@@ -44,7 +50,10 @@ class gallery_shortcodes extends e_shortcode
// echo "
".$attFull;
- $text = "";
+ $caption = $tp->toAttribute($this->var['media_caption']) ;
+ $caption .= ($this->downloadable) ? " Download" : "";
+
+ $text = "";
$text .= "
";
$text .= "";
diff --git a/thumb.php b/thumb.php
index 7c858d6f2..15295fa41 100644
--- a/thumb.php
+++ b/thumb.php
@@ -222,6 +222,7 @@ class e_thumbpage
// Send required headers
$this->sendHeaders($thumbnfo);
+
// check browser cache
if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] && ($thumbnfo['lmodified'] <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) && (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $thumbnfo['md5s']))
@@ -311,6 +312,8 @@ class e_thumbpage
header('Cache-Control: must-revalidate');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $thumbnfo['lmodified']).' GMT');
header('Content-Length: '.$thumbnfo['fsize']);
+ header('Content-Disposition: filename='.$thumbnfo['basename']); // important for right-click save-as.
+
$ctype = self::ctype($thumbnfo['extension']);
if(null !== $ctype)
{
@@ -321,6 +324,7 @@ class e_thumbpage
$time = time() + 365 * 86400;
header('Expires: '.gmdate("D, d M Y H:i:s", $time).' GMT');
header("Etag: ".$thumbnfo['md5s']);
+
}
public static function ctype($ftype)