1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Gallery image-download option added.

This commit is contained in:
CaMer0n
2012-08-14 04:22:40 +00:00
parent a1f94abbb6
commit 189e866f31
3 changed files with 16 additions and 2 deletions

View File

@@ -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')),

View File

@@ -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 "<br /><br />".$attFull;
$text = "<a class='".$class."' title='".$tp->toAttribute($this->var['media_caption'])."' href='".$tp->thumbUrl($this->var['media_url'], $attFull)."' rel='{$rel}' >";
$caption = $tp->toAttribute($this->var['media_caption']) ;
$caption .= ($this->downloadable) ? " <a class='e-tip smalltext' title='Right-click > Save Link As' href='".$tp->thumbUrl($this->var['media_url'], $attFull)."'>Download</a>" : "";
$text = "<a class='".$class."' title=\"".$caption."\" href='".$tp->thumbUrl($this->var['media_url'], $attFull)."' rel='{$rel}' >";
$text .= "<img class='".$class."' src='".$tp->thumbUrl($this->var['media_url'],$att)."' alt='' />";
$text .= "</a>";

View File

@@ -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)