Developer forum

Forum » Swift » Swift – img-srcset is inconsistent.

Swift – img-srcset is inconsistent.

Mads Poulsen
Mads Poulsen
Reply

It can be difficult to recreate;
Try adjusting the screen size a few times and refresh afterwards, it gives a different srcset size from time to time.
Attached images are from exactly the same browser width, but one gives a blurred image, and the other looks nice.

imgsrcsetexample.jpg

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Mads

You can follow what img is currently in use in dev tools:

I cannot see it does things wrong. The browser will choose different images in different viewports which is the point.

If you have input for another srcset/sizes combination we are happy to test it.

 
Mads Poulsen
Mads Poulsen
Reply

Hi Nicolai,

I see – The thing is, that I sometimes get 640 width and sometimes get 960 width, within the same viewport. Not sure why;
"http://sjorring.test001.webtester.dk/Admin/Public/GetImage.ashx?image=%2fFiles%2fImages%2fsjorring%2fcases%2fcase-steelwrist.jpg&width=640&quality=85&format=webp"
"http://sjorring.test001.webtester.dk/Admin/Public/GetImage.ashx?image=%2fFiles%2fImages%2fsjorring%2fcases%2fcase-steelwrist.jpg&width=960&quality=85&format=webp"

The uploaded image is '1920 × 1080'.

But – It could look as if the error accurs because there's chosen 1/1 format on the image within Swift – So when the browser (sometimes) delivers 640 width, it has to stretch the image to be able to make 1/1, though it is no longer high enough due to the chosen srcset.

 

You must be logged in to post in the forum