VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: man.of.earth on October 24, 2019, 14:18:10 PM

Title: Suggestion: adding „width” and „height” attibutes to images
Post by: man.of.earth on October 24, 2019, 14:18:10 PM
Hello,

Some sources recommend that images have the ,,width" and ,,height" attributes set, for speed, easiness in rendering the pages and SEO reasons.
I was wondering: could this be added to the core?

Some time ago I did some custom modifications in the administrator/components/com_virtuemart/helpers/mediahandler.php (around line 654):
if($lightbox){
$full_url=$root . $file_url;
if((substr($full_url, 0, 4)!="http") and (substr($full_url, 0, 1)!="/")) $full_url='/' . $full_url;
$size = getimagesize($_SERVER['DOCUMENT_ROOT'] . '/' . $file_url);
$image = '<img src="' . $full_url . '" alt="' . $file_alt . '" title="' . $file_alt . '" ' . $args . ' width="' . $size[0] . '" height="' . $size[1] . '"/>'; #//JHtml::image($file_url, $file_alt, $imageArgs);

but maybe there is a simpler way to achieve this.
Thanks developers team for your attention.