We have a 2:3 image element that for most user uploaded images the best render is Zoom, but occasionally users upload images that are landscape that would be best rendered as Rescale. Is there any way to read the dimensions of the image and render conditionally?
None that I know of … natively.
You could have an external service return you the image dimensions.
Hi there, I hope you are doing well.
If you want to adjust image rendering based on user-uploaded dimensions, detect the image’s aspect ratio by checking its width and height. Use Zoom if the aspect ratio is close to 2:3 to fill the frame or Rescale for wider images to keep more of the image visible. This ensures each image is displayed in the most visually appealing way.
Thank You,
Mike Taku.
1 Like
@mustafamteck Has a great point!
If in the frontend you can do this image by image then you can access its dimensions to establish conditions: