srcset and dpr with AdvancedImage React component
Hello,
I'm trying to set the srcset and dpr using the AvancedImage component, but cannot find any documentation on how to do this.
I'm assuming the srcset will be generated by cloudinary if dpr or another property is set? How can I set dpr to auto using `@cloudinary/url-gen` or `@cloudinary/react`? Your documentation is not very helpful with the exact options available here.
-
Hi there,
Thanks so much for reaching out.
I saw that you opened a support ticket asking the same question, which I answered there directly. But I will post here as well, for the benefit of others who may be looking for the same information.
Version 2 of the React SDK does not support dpr_auto, and we will not be adding support for that, but this is something you can implement yourself, using something similar to this ( in pseudocode ):
setDPR(devicePixelRatio || 1)
Have you had a chance to look over the responsive images plugin? You can use this plugin to make all of your images responsive so that they automatically resize based on the viewport size. You can reference that documentation here:
https://cloudinary.com/documentation/react_image_transformations#responsive_imagesHope this helps. Let us know if you have questions.
0
Post is closed for comments.
Comments
1 comment