1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Bootstrap3 news and search-menu template fixes.

New thumb.php placeholder feature added.
New {GLYPH} shortcode added. Usage: {GLYPH=time}
This commit is contained in:
Cameron
2013-12-31 09:59:19 -08:00
parent bbb22c140f
commit 5a4d97ca9a
13 changed files with 199 additions and 44 deletions

View File

@@ -68,6 +68,8 @@ class e_thumbpage
/** Stores watermark prefs
*/
protected $_watermark = array();
private $_placeholder = false;
/**
* Constructor - init paths
@@ -163,9 +165,10 @@ class e_thumbpage
function checkSrc()
{
if(!vartrue($this->_request['src']))
if(!vartrue($this->_request['src'])) // display placeholder when src is missing.
{
return false;
$this->_placeholder = true;
return true;
}
$tp = e107::getParser();
@@ -195,6 +198,11 @@ class e_thumbpage
$this->_src_path = $path;
return true;
}
else
{
$this->_placeholder = true;
return true;
}
// echo "path=".$path."<br />";
return false;
@@ -203,6 +211,18 @@ class e_thumbpage
function sendImage()
{
//global $bench;
if($this->_placeholder == true)
{
$width = ($this->_request['aw']) ? $this->_request['aw'] : $this->_request['w'];
$height = ($this->_request['ah']) ? $this->_request['ah'] : $this->_request['h'];
$parm = array('size' => $width."x".$height);
$this->placeholder($parm);
return;
}
if(!$this->_src_path)
{
return $this;
@@ -214,6 +234,8 @@ class e_thumbpage
$cache_str = md5(serialize($options).$this->_src_path);
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
if(is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname))
{
$thumbnfo['lmodified'] = filemtime(e_CACHE_IMAGE.$fname);
@@ -237,6 +259,7 @@ class e_thumbpage
@readfile(e_CACHE_IMAGE.$fname);
//$bench->end()->logResult('thumb.php', $_GET['src'].' - retrieve cache');
exit;
}
@@ -267,7 +290,7 @@ class e_thumbpage
{
$thumb->adaptiveResize((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0));
}
// Watermark Option - See admin->MediaManager->prefs for details.
if($this->_watermark['activate'] < $options['w']
@@ -282,11 +305,15 @@ class e_thumbpage
$thumb->WatermarkText($this->_watermark);
}
// echo "hello";
//exit;
// set cache
$thumb->save(e_CACHE_IMAGE.$fname);
// show thumb
$thumb->show();
}
@@ -333,6 +360,8 @@ class e_thumbpage
}
public static function ctype($ftype)
{
static $known_types = array(
@@ -350,6 +379,20 @@ class e_thumbpage
}
return null;
}
// Display a placeholder image.
function placeholder($parm)
{
$getsize = isset($parm['size']) ? $parm['size'] : '100x100';
$dimensions = explode('x', $getsize);
header('location: http://placehold.it/'.$getsize);
header('Content-Length: 0');
exit();
}
}
?>