--- import CategoryNav from './CategoryNav.astro'; import Slideshow from './Slideshow.astro'; import SlideControls from './SlideControls.astro'; import favorites from '../../data/favorites.json'; // Auto-détection des images const allImages = import.meta.glob<{ default: ImageMetadata }>('/src/assets/images/photos/categories/**/*.{jpg,jpeg,png,webp}'); // Charger les images favorites const favoriteImages = await Promise.all( favorites.map(async (relativePath: string) => { const fullPath = `/src/assets/images/photos/categories/${relativePath}`; const loader = allImages[fullPath]; if (!loader) { console.warn(`Image favorite non trouvée: ${fullPath}`); return null; } const img = await loader(); const filename = relativePath.split('/').pop() || ''; const title = filename .replace(/\.[^/.]+$/, '') .replace(/-/g, ' ') .replace(/_/g, ' '); return { src: img.default, // ImageMetadata pour alt: title, title: title, category: relativePath.split('/')[0] }; }) ); // Filtrer les nulls (images non trouvées) const images = favoriteImages.filter(img => img !== null); // Préparation des données pour JavaScript (avec URL au lieu de ImageMetadata) const imagesForJS = JSON.stringify(images.map(img => ({ src: img.src.src, // Extraire l'URL de ImageMetadata alt: img.alt, title: img.title, category: img.category }))); ---