Updated product image size shows old size

  • Posts: 132
  • Thank you received: 3
  • Hikashop Business
1 week 5 days ago #364876

-- HikaShop version -- : 5.1.1
-- Joomla version -- : 5.2.2
-- PHP version -- : 8.2
-- Browser(s) name and version -- : All
-- Error-message(debug-mod must be tuned on) -- : None

I am working on a dev site, trying to optimize my product images. They were set to display at 300px wide, but I changed that to 400px, see screenprint). However, upon accessing the page (also after a repeat visit), the initial image shows at 300 px still, though the div inside which is shown is at 400 x 400 now. Hovering over any other thumbnial (including the thumbnail for the inital image) does show the images at 400px.

I do not use caching, but just to be sure, I issued a clear cache inside Joomla and from the hosting panels.

Can you tell me how to fix this? Let me know if you need backend access.



Attachments:

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
1 week 5 days ago #364877

Hi,

If I check the HTML of your page I see this:
i.imgur.com/01ykJwI.png
The img tag of the main image has a width and a height attributes with a value of 300.

This is done by the code:

			$attributes = 'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"';
			if($img->external && $img->req_width && $img->req_height)
				$attributes .= ' width="'.$img->req_width.'" height="'.$img->req_height.'"';
			$html = '<img id="hikashop_main_image'.$variant_name.'" '.$attributes.' title="'.$this->escape((string)@$image->file_description).'" alt="'.$this->escape((string)@$image->file_name).'" src="'.$img->url.'"/>';
in the view file product / show_block_img.
So, if you look at the if in this code, the width and height attributes are actually only added if the image is an external image (meaning that the image is not on your website and the src attribute contains the full URL of the image).
The image on your page is a local file, so this $img->external variable should be set to false, and thus the width and height attributes should not be added to the img tag.
On top of this, the $img->req_width and $img->req_height should normally be the same as the thumbnail folder path as the code generating the thumbnail bases itself on the same values.

So, in short, I'm surprised you're able to get the result you see on your page. There are at least 2 things which makes this normally not possible. Also, I'm not able to reproduce the issue on my end. So, I'm thinking that you might have a view override of that view file with a different code.
Check if you have the file templates/YOUR_TEMPLATE/html/com_hikashop/product/show_block_img.php via FTP. If you have it, rename it to something else in order to deactivate the view override. Hopefully, it will fix the problem, confirming that the problem comes from some custom code.

If all this doesn't help, we'll need a backend access in order to check the situation more in depth.

Last edit: 1 week 5 days ago by nicolas.

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

  • Posts: 132
  • Thank you received: 3
  • Hikashop Business
1 week 5 days ago #364884

Hi Nicolas, I had neither template override, but your analysis pointed me in the right direction. Indeed one of my optimization plugins enforced the 300 x 300 dimension. Disabling it solved my issue.

Many thanks for your swift response!

The following user(s) said Thank You: nicolas

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

Time to create page: 0.073 seconds
Powered by Kunena Forum