mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Include width/height attributes in img tags with cropped thumbnails. toImage() and toIcon() methods.
This commit is contained in:
@@ -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] == '{')
|
||||||
{
|
{
|
||||||
@@ -3347,7 +3349,8 @@ class e_parser
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return "<img class='icon' src='".$path."' alt='".basename($path)."' />";
|
|
||||||
|
return "<img class='icon' src='".$path."' alt='".basename($path)."' ".$dimensions." />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -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} />";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user