I would like to create a gallery like Google+ "Photos From Your Circles" in which the thumbnails looks like a collage.
Please see the screenshot as example: http://ansonalex.com/wp-content/uploads/2011/07/google-plus-gallery-large.jpg
i would like to learn how can i use css/javascript/jquery to style gallery thumbnails like this at the client side programatically.
Thank you for answers!
You may find this write-up helpful: Building a Google Plus Inspired Image Gallery
He uses a technique that does not require sorting the images, and it's pretty simple. Basically, once you know the width W of your rows of thumbnails, keep placing thumbnails until the total width exceeds W. Let's say you exceed W by 40px. Now, crop each thumbnail in the row (via css) to remove 40 pixels total.
If, say, you want to crop 10px from an image, you can do it with something like this:
<div style="width:[cropped width]; height:[height]; margin-left:-5px; overflow:hidden;">
<img style="width:[true width]; height:[height];" src="path/to/thumbnail.jpg" />
</div>
The overflow:hidden crops the image, and the negative margin centers it horizontally, basically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With