1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Issue #2426, Fixes #2427 - Use empty image when 'src' mode is being used for {NEWS_IMAGE} and no image is found.

This commit is contained in:
Cameron
2017-02-20 17:30:11 -08:00
parent 8963dacc46
commit df63b6e761

View File

@@ -835,6 +835,9 @@ class news_shortcodes extends e_shortcode
$tmp = $this->handleMultiple($parm); $tmp = $this->handleMultiple($parm);
$srcPath = $tmp['file']; $srcPath = $tmp['file'];
$class = (!empty($parm['class'])) ? $parm['class'] : "news_image news-image img-responsive img-fluid img-rounded rounded"; $class = (!empty($parm['class'])) ? $parm['class'] : "news_image news-image img-responsive img-fluid img-rounded rounded";
@@ -844,22 +847,20 @@ class news_shortcodes extends e_shortcode
if($tp->isVideo($srcPath)) if($tp->isVideo($srcPath))
{ {
return;
return null;
} }
else else
{ {
if(!$srcPath) if(empty($srcPath))
{ {
if(varset($parm['type']) == 'placeholder' || vartrue($parm['placeholder'])) if(varset($parm['type']) == 'placeholder' || vartrue($parm['placeholder']))
{ {
$src = $tp->thumbUrl(); // placeholder; $src = $tp->thumbUrl(); // placeholder;
$dimensions = $tp->thumbDimensions(); $dimensions = $tp->thumbDimensions();
} }
else
{
return;
}
} }
elseif($srcPath[0] == '{' ) // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change. elseif($srcPath[0] == '{' ) // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change.
{ {
@@ -871,19 +872,20 @@ class news_shortcodes extends e_shortcode
else else
{ {
// We store SC path in DB now + BC // We store SC path in DB now + BC
$src = $srcPath[0] == '{' ? $tp->replaceConstants($srcPath, 'abs') : e_IMAGE_ABS."newspost_images/".$srcPath; $src = $srcPath[0] == '{' ? $tp->replaceConstants($srcPath, 'abs') : e_IMAGE_ABS."newspost_images/".$srcPath;
} }
} }
if(vartrue($parm['nolegacy'])) // Remove legacy thumbnails. if(!empty($parm['nolegacy'])) // Remove legacy thumbnails.
{ {
$legSrc = urldecode($src); $legSrc = urldecode($src);
if(strpos($legSrc,'newspost_images/thumb_')!==false) if(strpos($legSrc,'newspost_images/thumb_')!==false)
{ {
return; return null;
} }
} }
@@ -906,7 +908,7 @@ class news_shortcodes extends e_shortcode
switch(vartrue($parm['type'])) switch(vartrue($parm['type']))
{ {
case 'src': case 'src':
return $src; return empty($src) ? e_IMAGE_ABS."generic/nomedia.png" : $src;
break; break;
case 'tag': case 'tag':
@@ -947,7 +949,11 @@ class news_shortcodes extends e_shortcode
{ {
return $url; return $url;
} }
return "<a style='".(isset($this->param['itemlink']) ? $this->param['itemlink'] : 'null')."' href='{$url}'>".e107::getParser()->toHTML($this->news_item['news_title'], TRUE, "TITLE").'</a>';
unset($parm['link']);
$title = $this->sc_news_title($parm);
return "<a style='".(isset($this->param['itemlink']) ? $this->param['itemlink'] : 'null')."' href='{$url}'>".$title.'</a>';
} }
function sc_newsurl($parm=null) function sc_newsurl($parm=null)