mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Gallery image-download option added.
This commit is contained in:
@@ -137,7 +137,8 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
protected $prefs = array(
|
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_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')),
|
'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_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')),
|
// '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')),
|
||||||
|
@@ -18,6 +18,12 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
public $sliderCat = 1;
|
public $sliderCat = 1;
|
||||||
public $slideMode = FALSE;
|
public $slideMode = FALSE;
|
||||||
public $slideCount = 1;
|
public $slideCount = 1;
|
||||||
|
private $downloadable = FALSE;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->downloadable = e107::getPlugPref('gallery','downloadable');
|
||||||
|
}
|
||||||
|
|
||||||
function sc_gallery_caption($parm='')
|
function sc_gallery_caption($parm='')
|
||||||
{
|
{
|
||||||
@@ -44,7 +50,10 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
// echo "<br /><br />".$attFull;
|
// 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 .= "<img class='".$class."' src='".$tp->thumbUrl($this->var['media_url'],$att)."' alt='' />";
|
||||||
$text .= "</a>";
|
$text .= "</a>";
|
||||||
|
|
||||||
|
@@ -222,6 +222,7 @@ class e_thumbpage
|
|||||||
|
|
||||||
// Send required headers
|
// Send required headers
|
||||||
$this->sendHeaders($thumbnfo);
|
$this->sendHeaders($thumbnfo);
|
||||||
|
|
||||||
|
|
||||||
// check browser cache
|
// 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']))
|
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('Cache-Control: must-revalidate');
|
||||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $thumbnfo['lmodified']).' GMT');
|
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $thumbnfo['lmodified']).' GMT');
|
||||||
header('Content-Length: '.$thumbnfo['fsize']);
|
header('Content-Length: '.$thumbnfo['fsize']);
|
||||||
|
header('Content-Disposition: filename='.$thumbnfo['basename']); // important for right-click save-as.
|
||||||
|
|
||||||
$ctype = self::ctype($thumbnfo['extension']);
|
$ctype = self::ctype($thumbnfo['extension']);
|
||||||
if(null !== $ctype)
|
if(null !== $ctype)
|
||||||
{
|
{
|
||||||
@@ -321,6 +324,7 @@ class e_thumbpage
|
|||||||
$time = time() + 365 * 86400;
|
$time = time() + 365 * 86400;
|
||||||
header('Expires: '.gmdate("D, d M Y H:i:s", $time).' GMT');
|
header('Expires: '.gmdate("D, d M Y H:i:s", $time).' GMT');
|
||||||
header("Etag: ".$thumbnfo['md5s']);
|
header("Etag: ".$thumbnfo['md5s']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ctype($ftype)
|
public static function ctype($ftype)
|
||||||
|
Reference in New Issue
Block a user