Replies: 2 comments 3 replies
-
Ultimately, I am trying to use Cloudinary as the image host for an image gallery using Lightgallery. I want it to look like the masonry layout that LightGallery advertises, but if I can't scale the images down while maintaining the aspect ratio, then… I don't know how I'm supposed to do that. Certainly I don't want to load the full-size images and try to scale THOSE for the thumbnails! |
Beta Was this translation helpful? Give feedback.
-
hey @nk9 - to give some background, CldImage is a wrapper around the Next.js Image component. this requirement actually comes from that component, but with good reason, to avoid layout shifts, but it's not always simple to have the dimensions like what it seems you're running into the Next.js Image component has the ability to set teh https://nextjs.org/docs/api-reference/next/image#fill this should work similarly with I also have an example thats using it here though its skewed a bit because of the height i fixed on to it to show it working: https://next-cloudinary.spacejelly.dev/components/cldimage/examples#next-image-features |
Beta Was this translation helpful? Give feedback.
-
The Cloudinary docs discuss resizing images, and say it's possible to provide just one dimention and have the other dimension calculated and the aspect ratio maintained. But when I leave the width out of
CldImage
, React complains.How do I scale down an image to a single fixed dimension while maintaining the aspect ratio?
Beta Was this translation helpful? Give feedback.
All reactions