How to force Height & Width attributes for images?

  • Posts: 329
  • Thank you received: 94
9 years 6 months ago #230521

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.6.15
-- Browser(s) name and version -- : N/A
-- Error-message(debug-mod must be tuned on) -- : No error message, exactly...

Is there a way to force HikaShop to put image height and width attributes in the HTML source code for all product and category images? On the example URL I provided in this post (private) Google webmaster tools is flagging all of the product images as lacking height and width attributes. That Is there a way to make HikaShop set the image dimension attribures automatically, or do we need to customize to handle that?


~ Deb Cinkus, CEO

Polished Geek: more with monday․com
eCommerce Business Process Automation Experts

Please Log in or Create an account to join the conversation.

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
9 years 6 months ago #230528

Hi,

You need to edit the different view files where images are output and add the width and height attributes to the img tag there.

For example, in the file show_block_img, you can edit the line:

$html = '<img id="hikashop_main_image'.$variant_name.' "itemprop="image" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"/>';
and use $img->width and $img->height

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum