SPECIAL OFFER: Only $69 for access to everything in OSTraining for 1 year! You save $75!  1
Join today and get access to 1,000's of books and videos. Learn WordPress, Drupal, Magento, Joomla and more! Sign up today!

Missing both IMG width and height attributes

8 years 3 weeks ago - 8 years 3 weeks ago #79677 by johnniek2
I am using SEO profiler tool and it gives me this error when it checks my website Johnnie's taxi transfers Zadar website :

Image problems

Missing both IMG width and height attributes (6)

The image is missing both the width and height attributes that would make the image appear faster when showing the page in the web browser. Search engines take the page speed into account.

Source URL: " www.johnnie.hr/media/mod_languages/images/de.gif "
Source URL: " www.johnnie.hr/media/mod_languages/images/en.gif "
Source URL: " www.johnnie.hr/media/mod_languages/images/fr.gif "
Source URL: " www.johnnie.hr/media/mod_languages/images/it.gif "
Source URL: " www.johnnie.hr/media/mod_languages/images/ru.gif "
Source URL: " www.johnnie.hr/media/mod_languages/images/sv.gif "


maybe its not kind of a big deal, but I would really like to fix that code so it doesnt destroy my layout of images the site should remain responsive. Can someone provide me with an idea how to solve this isuue for good?

thank a lot

Please Log in to join the conversation.

8 years 2 weeks ago #79701 by Nick
Hi Johnnie,

It shouldn't actually mess up your responsiveness. However, if you want to add the height and width attributes, you'd have to create a template override for modules/mod_languages/tmpl/default.php and custom code that feature into it.

Hope this helps!

Kind regards,
Nick

Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining

Please Log in to join the conversation.

8 years 2 weeks ago #79741 by johnniek2
Replied by johnniek2 on topic Missing both IMG width and height attributes
would it be a problem for you to give me an example how that php code should look like?

Please Log in to join the conversation.

8 years 2 weeks ago - 8 years 2 weeks ago #79751 by Valentin
Replied by Valentin on topic Missing both IMG width and height attributes
Hi Johnnie!

Following the Nick's suggestion, you would need to copy the file: modules/mod_languages/tmpl/default.php and place it in: templates/mytemplate/html/mod_languages/default.php

mytemplate means the template you are using.

would it be a problem for you to give me an example how that php code should look like?

You need to take a look in thedefault.php you duplicated inside your template to add the width and height attributes in the proper place, is around line:34

The code would change to this (adding width and height attributes to images):
<?php echo JHtml::_('image', 'mod_languages/'.$language->image.'.gif', $language->title_native, array('title'=>$language->title_native, 'width'=>30, 'height'=>30), true);?>

Hope this helps

Kind regards,
Valentín

Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining

Please Log in to join the conversation.

8 years 2 weeks ago #79752 by Nick
Also, you can try seeing if the image width and height can be detected using:
<?php echo JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title_native, array('title' => $language->title_native, 'width' => $image->width, 'height' => $image->height), true);?>

Kind regards,
Nick

Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining

Please Log in to join the conversation.

8 years 2 weeks ago #79760 by johnniek2
Replied by johnniek2 on topic Missing both IMG width and height attributes
Valentin and Nick, thank you so Much!

Please Log in to join the conversation.

8 years 2 weeks ago #79769 by Nick
You're very welcome, Johnnie! We're glad we could be of help! :)

Cheers,
Nick

Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining

Please Log in to join the conversation.

Join today and get access to 1,000's of books and videos. Learn WordPress, Drupal, Magento, Joomla and more! Sign up today!