I'm currently working on a new web project and I want to incorporate a masonry view for the images on the homepage.
The plan is to host this project on Azure, using blob storage for all the images. My idea is to organize the images for the masonry view in a specific subdirectory - let's name it "masonryImages" where I can easily add or remove images without affecting the HTML page.
Here's what I aim to achieve:
- Reference the source folder of the images for the HTML page.
- Iterate through this folder to a. determine the number of images required for the masonry view (approximately 50) and b. create an array of image sources.
- Automatically populate the HTML page with the .count and .src of these images instead of manually coding each detail.
I've been experimenting with a simple masonry layout:
<div class="masonry">
<div class="mItem">
<img src="https://source.unsplash.com/random/300">
</div>
<div class="mItem">
<img src="https://source.unsplash.com/random/100">
</div>
<div class="mItem">
<img src="https://source.unsplash.com/random/50">
</div>
<div class="mItem">
<img src="https://source.unsplash.com/random/600">
</div>
</div>
& For CSS styling
.masonry {
column-count: 5;
column-gap: 16px;
}
***** MY QUERY IS *****
Is there a way to dynamically generate elements in a masonry view based on the number of images in the source folder and display all images using their folder index?