Forum How do I...?

How does Prince parse the <img> srcset attribute?

nikhiltri
Hey all,

I have images in my pages that look like this (formatted here for readability. URLs work if you want to see the images):

<img src="https://artic-web.imgix.net/null3111e1af-ac0b-4d60-a911-b26adf957c75/TiffanyWindow.jpg?w=25"
    srcset="
        https://artic-web.imgix.net/null3111e1af-ac0b-4d60-a911-b26adf957c75/TiffanyWindow.jpg?w=300 300w, 
        https://artic-web.imgix.net/null3111e1af-ac0b-4d60-a911-b26adf957c75/TiffanyWindow.jpg?w=600 600w, 
        https://artic-web.imgix.net/null3111e1af-ac0b-4d60-a911-b26adf957c75/TiffanyWindow.jpg?w=1000 1000w, 
        https://artic-web.imgix.net/null3111e1af-ac0b-4d60-a911-b26adf957c75/TiffanyWindow.jpg?w=1500 1500w, 
        https://artic-web.imgix.net/null3111e1af-ac0b-4d60-a911-b26adf957c75/TiffanyWindow.jpg?w=3000 3000w"
    sizes="100vw">


The srcset attribute defines a set of images that browsers can choose between based on the window's width. It's a mechanism to implement responsive images that's supported by most browsers today.

How can the Prince XML parser be asked to choose one of the images in the `srcset` attribute? Currently it uses the default image in `src`, which in our case and in most will be a low-quality image placeholder. I see that we can set a `@page size` CSS attribute, but that doesn't seem to translate to choosing an image within the srcset. Is this possible?

Thanks!
nikhil
mikeday
Prince does not currently support the srcset attribute, but we can add it to the roadmap.
nikhiltri
That would be great. Thanks!