diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 6d92063c7..b52d68b0e 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -733,7 +733,7 @@ class news_shortcodes extends e_shortcode $this->imageItem = varset($media[$parm['item']]); // Set the current Image for other image shortcodes. - if(vartrue($parm['placeholder'])) + if(!empty($parm['placeholder'])) { return $this->sc_newsimage('placeholder'); } @@ -853,10 +853,10 @@ class news_shortcodes extends e_shortcode } else { - + if(empty($srcPath)) { - if(varset($parm['type']) == 'placeholder' || vartrue($parm['placeholder'])) + if(varset($parm['type']) == 'placeholder' || !empty($parm['placeholder'])) { $src = $tp->thumbUrl(); // placeholder; $dimensions = $tp->thumbDimensions(); @@ -899,8 +899,9 @@ class news_shortcodes extends e_shortcode $imgParms = array( 'class'=>$class, - 'alt'=>basename($src), - 'style'=>$style + 'alt'=>basename($srcPath), + 'style'=>$style, + 'placeholder'=>varset($parm['placeholder']) ); diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 41d66eb6d..a713303f7 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3962,29 +3962,34 @@ class e_parser public function toImage($file, $parm=array()) { - if(empty($file)) - { - return null; - } - if(strpos($file,'e_AVATAR')!==false) { return "
Use \$tp->toAvatar() instead of toImage() for ".$file."
"; // debug info only. } - $srcset = null; - $path = null; - $file = trim($file); - $ext = pathinfo($file, PATHINFO_EXTENSION); - $accepted = array('jpg','gif','png','jpeg'); - $tp = $this; - - if(!in_array($ext,$accepted)) + if(empty($file) && empty($parm['placeholder'])) { return null; } + if(!empty($file)) + { + $srcset = null; + $path = null; + $file = trim($file); + $ext = pathinfo($file, PATHINFO_EXTENSION); + $accepted = array('jpg','gif','png','jpeg'); + + + if(!in_array($ext,$accepted)) + { + return null; + } + } + + $tp = $this; + // e107::getDebug()->log($file); // e107::getDebug()->log($parm); @@ -4047,7 +4052,10 @@ class e_parser $path = $file; } - + if(empty($path) && !empty($parm['placeholder'])) + { + $path = $tp->thumbUrl($file,$parm); + } $id = (!empty($parm['id'])) ? "id=\"".$parm['id']."\" " : "" ; $class = (!empty($parm['class'])) ? $parm['class'] : "img-responsive img-fluid"; diff --git a/e107_plugins/news/templates/news_grid_template.php b/e107_plugins/news/templates/news_grid_template.php index 475a5dbf7..3550c318f 100644 --- a/e107_plugins/news/templates/news_grid_template.php +++ b/e107_plugins/news/templates/news_grid_template.php @@ -78,8 +78,8 @@ $NEWS_GRID_TEMPLATE['other']['featured'] = ' @@ -91,13 +91,13 @@