Secondary product images appear distorted

  • Posts: 457
  • Thank you received: 19
  • Hikashop Business
2 weeks 3 days ago #373061

Hi Nicolas,

We have noticed an issue with the secondary images in the product page gallery.

The secondary images are displayed very tall and narrow, which distorts their proportions and makes them difficult to view properly.

The main product image is displayed correctly. The issue only affects the secondary images/thumbnails.

Do you know what could be causing this?

Attachments:

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

  • Posts: 86081
  • Thank you received: 14189
  • MODERATOR
2 weeks 2 days ago #373067

Hi,

That comes from the CSS of your template, not from the thumbnails themselves.

HikaShop generates the thumbnails at a fixed size and writes that size on the image tag, like this :

<img class="hikashop_child_image" width="100" height="100" src="..."/>

If the CSS of your template contains a rule which forces the width of the images, for example img { width: 100% }, without setting the height back to auto, the browser stretches the image to the whole width of the column while it keeps the height written on the tag. The result is exactly what your screenshot shows : thumbnails as wide as the block and completely flattened. The main image is not affected because it sits in a container of its own size.

Two ways to confirm it in one minute :

- open one of the thumbnails alone in a browser tab (right click on it, open the image in a new tab). If the file itself has the right proportions, then it is the CSS of the page.
- right click on a thumbnail and choose Inspect : the rule which sets the width will be shown in the styles panel, with the name of the CSS file it comes from.

The fix is to add this in the custom CSS of your template :
.hikashop_small_image_div img,
.hikashop_small_image_div picture img {
	width: auto !important;
	height: auto !important;
	max-width: 100%;
}

Note that HikaShop never distorts an image : the two modes available in the configuration for the thumbnails are "keep the ratio" and "crop", so a generated thumbnail always keeps its proportions.

If that does not solve it, give me the address of a product page of your website and I will look at it directly.

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

Time to create page: 0.191 seconds
Powered by Kunena Forum