1
0
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:
Cameron
2017-03-04 10:06:53 -08:00
parent 0f42d516e7
commit aaa5db36ab
3 changed files with 34 additions and 25 deletions

View File

@@ -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";