How to force Height & Width attributes for images?
- PolishedGeek
-
Topic Author
- Offline
- Official HikaShop Development Partner
Less
More
10 years 7 months ago #230521
by PolishedGeek
~ Deb Cinkus, CEO
Polished Geek: more with monday․com
eCommerce Business Process Automation Experts
How to force Height & Width attributes for images? was created by PolishedGeek
-- 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?
-- 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.
10 years 7 months ago #230528
by nicolas
Replied by nicolas on topic How to force Height & Width attributes for images?
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:
and use $img->width and $img->height
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:
Code:
$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.'"/>';
Please Log in or Create an account to join the conversation.
Time to create page: 0.152 seconds