mirror of
https://github.com/e107inc/e107.git
synced 2025-08-14 02:24:08 +02:00
tp->toImage() now accepts 'placeholder' parm. NewsGrid template now uses placeholder by default.
This commit is contained in:
@@ -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 "<div class='alert alert-danger'>Use \$tp->toAvatar() instead of toImage() for ".$file."</div>"; // 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";
|
||||
|
Reference in New Issue
Block a user