How to dynamically render a masonry layout of images, while preserving aspect ratio?

This page summarizes the projects mentioned and recommended in the original post on /r/webdev

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • Masonry

    :love_hotel: Cascading grid layout plugin (by desandro)

  • Well then take a look at the source code https://github.com/desandro/masonry and build it buy yourself.

  • MiniMasonry.js

    Minimalist dependancy free Masonry layout library

  • Do you know the width/height of your images ? If so you can use https://github.com/Spope/MiniMasonry.js Look for the codepen link in the examples.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • houdini-samples

    Demos for different Houdini APIs

  • There's an implementation from Google in this CSS Houdini samples repo: https://github.com/GoogleChromeLabs/houdini-samples/tree/master/layout-worklet/masonry

    Use a library, there are many small issues with these renders and doing them right will make it look much better. My favorite is the pro-gallery https://github.com/wix/pro-gallery/ Disclaimer, I wrote it :)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts