Replies: 1 comment 1 reply
-
Hi, this library implements only the cropping approach. If you looking for a gallery with different row heights I recommend you to check out this one https://github.com/igordanchenko/react-photo-album. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, the user provides a row height, and every row is fit to that height. This means that individual images are cropped to get clean justification, sometimes substantially.
There is another approach. You can find the number of images for a given row which fits within the width constraint. Then, find the row height where all the image widths and margins add up to the container width, scaling each image as necessary. This results in different rows having different heights, but it avoids (most) cropping. (Not clear to me if it will always be possible to perfectly maintain aspect ratio and margins while justifying photos without any cropping at all, but it should be possible to do it with no more than a few pixels of cropping.)
As far as I can tell, this second approach is the one taken on most pro image galleries like Google Photos, OneDrive, Flickr etc. I do not have an actual algorithm for this, but it's pretty clear that's what's happening just from looking at them.
If I've missed the way to configure RGG to work in this second way, please let me know! Otherwise, please consider this a feature request.
Beta Was this translation helpful? Give feedback.
All reactions