1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Include width/height attributes in img tags with cropped thumbnails. toImage() and toIcon() methods.

This commit is contained in:
Cameron
2016-02-07 13:37:45 -08:00
parent 8660d2d890
commit 3c43d07d83

View File

@@ -3309,6 +3309,7 @@ class e_parser
} }
$ext = pathinfo($icon, PATHINFO_EXTENSION); $ext = pathinfo($icon, PATHINFO_EXTENSION);
$dimensions = null;
if(!$ext || $ext == 'glyph') // Bootstrap or Font-Awesome. if(!$ext || $ext == 'glyph') // Bootstrap or Font-Awesome.
{ {
@@ -3318,6 +3319,7 @@ class e_parser
if(strpos($icon,'e_MEDIA')!==FALSE) if(strpos($icon,'e_MEDIA')!==FALSE)
{ {
$path = $this->thumbUrl($icon); $path = $this->thumbUrl($icon);
$dimensions = $this->thumbDimensions();
} }
elseif($icon[0] == '{') elseif($icon[0] == '{')
{ {
@@ -3344,10 +3346,11 @@ class e_parser
{ {
$path = $icon; $path = $icon;
} }
return "<img class='icon' src='".$path."' alt='".basename($path)."' ".$dimensions." />";
return "<img class='icon' src='".$path."' alt='".basename($path)."' />";
} }
@@ -3386,10 +3389,12 @@ class e_parser
$tp->setThumbSize(null, $parm['h']); $tp->setThumbSize(null, $parm['h']);
} }
$dimensions = null;
if(strpos($file,'e_MEDIA')!==false || strpos($file,'e_THEME')!==false) //v2.x path. if(strpos($file,'e_MEDIA')!==false || strpos($file,'e_THEME')!==false) //v2.x path.
{ {
$path = $tp->thumbUrl($file,null,null,true); $path = $tp->thumbUrl($file,null,null,true);
$dimensions = $this->thumbDimensions();
} }
elseif($file[0] == '{') // Legacy v1.x path. Example: {e_WHEREEVER} elseif($file[0] == '{') // Legacy v1.x path. Example: {e_WHEREEVER}
{ {
@@ -3431,7 +3436,7 @@ class e_parser
$alt = (!empty($parm['alt'])) ? $tp->toAttribute($parm['alt']) : basename($path); $alt = (!empty($parm['alt'])) ? $tp->toAttribute($parm['alt']) : basename($path);
return "<img class='img-responsive' src='".$path."' alt=\"".$alt."\" {$insertStyle} />"; return "<img class='img-responsive' src='".$path."' alt=\"".$alt."\" {$insertStyle} {$dimensions} />";
} }