How Can We Help?

< All Topics
Print

Shopify Tips | Manage Image Width in CDN URLs

This is a guide to help you submit the correctly scaled images within your product advertising feeds.

Shopify have made it very straightforward to control the pixel width of an image when it is served from their content delivery network – and Feed Donkey configuration will allow you to leverage the benefit of this for your feed builds.

When you create your products in Shopify – the main/ alternate images that you upload are potentially quite large (particularly if you are using these for zoom images).

When an image is uploaded/ assigned to a product (or variant) it creates a unique URL on the Shopify content delivery network – a CDN URL. And these point to the full/ orginal sized image.

So for example, in a list they would look similar to these:

In the Feed Donkey builder this is the data that would be output in columns usings the ‘product_featureImage.src’ field:

In your product feeds, channels may ask you to submit images that do not either exceed a certain pixel width or a certain filesize. It may be that it is the other way around i.e. images must be ‘at least’ a certain pixel width or size.

A simple adjustment of a CDN image URL will constrain the served image to a certain pixel width.

https://cdn.shopify.com/s/files/1/2222/3333/44444/files/IMG_123.jpg?v=123456

So taking the above dummy CDN url and if we imagine that this was current serving an image 1200 x 1200 pixels.

If we change the URL to

https://cdn.shopify.com/s/files/1/2222/3333/44444/files/IMG_123_200x.jpg?v=123456

We have added “_200x” just at the end of the file name, and just before the “.jpg” file extension text.

This will constrain the image on the width to 200 pixels and proportionally on the height. The served image will now be 200 x 200. If the orginal image URL pointed to a 1200 x 2400 image – the constrained version would be 200 x 400.

Note that you cannot ‘upscale’ an image using this method – only constrain the scale downwards.

e.g. adding “_2000x”

https://cdn.shopify.com/s/files/1/2222/3333/44444/files/IMG_123_2000x.jpg?v=123456

would not mean that you would get a 2000 x 2000 pixel sized image, it would still be 1200 x 1200.

This is an easy method of control though that we can employ to make sure that image data is not rejected by channels uneccessarily. Your Shopify store theme no doubt uses this technique to vary the image displayed on your category pages/ products results pages already.

So say for example a real world channel scenario. Idealo has a specification that no image should be bigger than 1MB. So we decide that no image should be larger that 1200 on the width. We have some images that have been uploaded as .jpg’s and some as .png’s.

In Feed Donkey this would be a simple text transformation to the CDN URLs

This would have the effect of constraining any very large images – it would not affect any images that were already smaller than 1200 width.

What this trick cannot do is as mentioned previously is make the original image larger – so say a channel says your image must be at least 800 x 800 pixels for example – if an image is smaller in your product db – you will have to upload a new larger version to Shopify to solve that particular error if it occurs.

Hope this helps you to build better feeds! We are happy to assist with any of your feed building conumdrums whatever they might be. Just reach out to us over the usual support channels!