Code to display product images at same size?

LaDolce-vid-des
Shopify Partner
15 0 3

Is there a way to add code to make all product thumbnails display as the same size on catalog pages? So for example have all photos display as squares in the below screenshot, but then have the original photos still when you click on the product. I'm trying to avoid having to manually crop all of my photos.

 

 

Screen Shot 2021-05-10 at 4.11.01 PM.png

Replies 2 (2)

Ninthony
Shopify Partner
2330 350 1024

You can rework your code to use background images instead of regular images and then give your container a specified height and width:

https://codepen.io/ninthony/pen/PopPNXd

Or alternatively you can give the images a set width and height with CSS and set the image element's object-fit property to "cover":

https://www.digitalocean.com/community/tutorials/css-cropping-images-object-fit

 

If my solution helped you, please like it and accept it as the solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish 😄
LaDolce-vid-des
Shopify Partner
15 0 3

Where in the liquid file would I implement this code?