Skip to content

Commit

Permalink
Fix issue #530: Image Optimization for remote Images does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypa committed Oct 10, 2024
1 parent 1413a45 commit 21830b3
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/components/common/Image.astro
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ const _image = await findImage(props.src);
let image: ImageType | undefined = undefined;
if (typeof _image === 'string') {
if ((_image.startsWith('http://') || _image.startsWith('https://')) && isUnpicCompatible(_image)) {
image = await getImagesOptimized(_image, props, unpicOptimizer);
} else {
image = {
src: _image,
attributes: { ...props, src: 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);
}
Expand Down

0 comments on commit 21830b3

Please sign in to comment.