The Astro component for lightgallery, JavaScript gallery for building beautiful image and video galleries for the web and the mobile. It provides some layouts to ease integration of lightgallery, written in css only.
Astro-lightGallery is released under the MIT license.
Astro-lightGallery is using lightGallery.
lightGallery is a free and open-source library, however,
if you are using the library for business, commercial sites, projects,
and applications, choose the commercial license to keep your source proprietary, to yourself.
Please refer to the lightGallery license page
Minimal setup, with the default layout of the gallery, which is adaptive.
When selecting an image, it is showed zoomed,
with a thumbnail below it.
Note that the gallery is displayed in a single line,
where options are the lightgallery options (thumbnail, zoom,…),
and layout contains the images to display:
// srcs is NOT provided in layout.srcs, so images are rendered using <img>
// the images are in /public repo, and the src path is the one on the server (without /public)
{ src: "/img01.jpg", },
{ src: "/img02.jpg", },
...
]
}}
options={{
thumbnail: true,
}}
/>
Google Photos Layout
When using layout.type: 'google-photos', the gallery is displayed with
the same layout as Google Photos. The height and the max-height of the gallery can be customized,
as well as the breakpoints.
Typically, the gallery displayed withe the default parameters
<LightGallery
layout={{
type: 'google-photos',
imgs: [...],
}}
/>
which is the same as
<LightGallery
layout={{
type: 'google-photos',
imgs: [...],
googlePhotos: {
height: '45vw',
maxHeight: '45vw',
breakpoints: {
601: { height: '20vw', maxHeight: '205px' },
}
}
}}
/>
Here is an example of the lightgallery with the google photos layout.
It is using layout.srcs in order to use astro’s <Image> component to render the gallery images,
and to have optimized images. No thumbnail specific images as <Image> optimizes it.