diff --git a/src/components/common/Image.astro b/src/components/common/Image.astro
index 75ad9ad..9bf8fe5 100644
--- a/src/components/common/Image.astro
+++ b/src/components/common/Image.astro
@@ -41,14 +41,45 @@ const _image = await findImage(props.src);
let image: ImageType | undefined = undefined;
-if (
- typeof _image === 'string' &&
- (_image.startsWith('http://') || _image.startsWith('https://')) &&
- isUnpicCompatible(_image)
-) {
- image = await getImagesOptimized(_image, props, unpicOptimizer);
-} else if (_image) {
- image = await getImagesOptimized(_image, props, astroAsseetsOptimizer);
+// In dev/preview, avoid Astro's on-demand /_image service to prevent 500s; serve the imported asset directly
+if (import.meta.env.DEV && _image && typeof _image !== 'string') {
+ image = {
+ src: _image.src,
+ attributes: {
+ width: typeof props.width === 'number' ? props.width : _image.width,
+ height: typeof props.height === 'number' ? props.height : _image.height,
+ alt: props.alt || '',
+ loading: props.loading || 'lazy',
+ decoding: props.decoding || 'async',
+ },
+ } as unknown as ImageType;
+}
+
+if (!image) {
+ if (
+ typeof _image === 'string' &&
+ (_image.startsWith('http://') || _image.startsWith('https://')) &&
+ isUnpicCompatible(_image)
+ ) {
+ image = await getImagesOptimized(_image, props, unpicOptimizer);
+ } else if (_image) {
+ image = await getImagesOptimized(_image, props, astroAsseetsOptimizer);
+ }
+}
+
+// Fallback: if optimization produced no output, render the original source directly
+if (!image && _image) {
+ const originalSrc = typeof _image === 'string' ? _image : _image.src;
+ image = {
+ src: originalSrc,
+ attributes: {
+ alt: props.alt || '',
+ width: typeof props.width === 'number' ? props.width : undefined,
+ height: typeof props.height === 'number' ? props.height : undefined,
+ loading: props.loading || 'lazy',
+ decoding: props.decoding || 'async',
+ },
+ } as unknown as ImageType;
}
---
@@ -56,6 +87,7 @@ if (
!image ? (
) : (
-
+ // Render without crossorigin to avoid CORS/COEP conflicts for local assets; keep attributes from optimizer
+
)
}