1
5
Astro 6.0 is here (astro.build)
2
2
submitted 3 weeks ago by nemeski@mander.xyz to c/astro@programming.dev
3
2

So i try to make a Gallery with Astro and i hope someone can help me to grasp a few things.

I have a folder called "assets" in "src" in which all the images reside.

I also have a .astro file in "pages".
In this file i try to get the images with:

const images = import.meta.glob('/src/assets/*.{jpeg,jpg,png,gif}')  
const resolvedImages = Object.entries(images)  

in the body of the .astro i try to map "resolvedImages"

{resolvedImages.map((image) => (  
	<Image src={image[0]} alt="blabla" />  
))}  

Which kinda works but feels wrong. That i have to write "image[0]" instead of "image.src" can't be the solution.

There seems to be something called "ImageMetadata " , which has all the things i would like to have access to (filepath, width, etc.). But i don`t understand how to use it.

When i try

const images = import.meta.glob<ImageMetadata>('/src/assets/*.{jpeg,jpg,png,gif}')  

I still can´t access the values. What am i not understanding?

Also, is that even the right approach? There is also the option to define a collection and get that but the docs say those are just for markdown?

Thanks in advance.

4
3
submitted 1 month ago by nemeski@mander.xyz to c/astro@programming.dev
5
3
Astro 5.17 released (astro.build)
submitted 1 month ago by nemeski@mander.xyz to c/astro@programming.dev
6
4
submitted 2 months ago by nemeski@mander.xyz to c/astro@programming.dev
7
4
Astro 6 Beta (astro.build)
submitted 2 months ago by nemeski@mander.xyz to c/astro@programming.dev
8
1
2025 year in review (astro.build)
submitted 2 months ago by nemeski@mander.xyz to c/astro@programming.dev
9
3
10
7
submitted 2 months ago by nemeski@mander.xyz to c/astro@programming.dev
11
2
submitted 3 months ago by nemeski@mander.xyz to c/astro@programming.dev
12
3
Astro 5.16 (astro.build)
submitted 4 months ago by nemeski@mander.xyz to c/astro@programming.dev
13
2
submitted 4 months ago by nemeski@mander.xyz to c/astro@programming.dev
14
5
Astro 5.15 (astro.build)
submitted 5 months ago by nemeski@mander.xyz to c/astro@programming.dev
15
4
Astro 5.14 (astro.build)
submitted 5 months ago by nemeski@mander.xyz to c/astro@programming.dev
16
3
submitted 6 months ago by nemeski@mander.xyz to c/astro@programming.dev
17
5
Astro 5.13 (astro.build)
submitted 7 months ago by nemeski@mander.xyz to c/astro@programming.dev
18
1
submitted 7 months ago by nemeski@mander.xyz to c/astro@programming.dev
19
4
Astro 5.12 (astro.build)
submitted 8 months ago by nemeski@mander.xyz to c/astro@programming.dev
20
1
Starlight 0.35 (astro.build)
submitted 8 months ago by nemeski@mander.xyz to c/astro@programming.dev
21
3
submitted 8 months ago by nemeski@mander.xyz to c/astro@programming.dev
22
2
submitted 9 months ago by neme@lemm.ee to c/astro@programming.dev
23
2
Astro 5.10 released (astro.build)
submitted 9 months ago by neme@lemm.ee to c/astro@programming.dev
24
5
submitted 10 months ago by neme@lemm.ee to c/astro@programming.dev
25
3
submitted 11 months ago by neme@lemm.ee to c/astro@programming.dev

Rejuvenate your docs with heading anchor links, Tailwind v4 support, CSS @layer, and a new head metadata API.

view more: next ›

Astro

195 readers
1 users here now

founded 2 years ago
MODERATORS