Getting image from API or CDN
zachandblue opened this issue · 4 comments
Is your feature request related to a problem? Please describe.
This seems to only work when the image is actually placed within the Assets folder. However when my image source is coming from a Wordpress REST API, for example, new optimized assets are not being created.
Example:
<img src="https://www.sampleurl.com/image.jpeg">
Describe the solution you'd like
A clear and concise description of what you want to happen.
It would be great if images with a source coming from an API or CDN were treated the same as images placed in the Assets folder, and optimized images were created for these as well.
Describe alternatives you've considered
The only alternative would be placing the images directly in the Assets folder, but this kind of defeats the purpose of using a headless Wordpress instance as a CMS.
Additional context
Add any other context or screenshots about the feature request here.
Sorry, but it's not posible to optimize external images. That's because this module relies on Webpack (also used by Nuxt itself when building the projects) to load only local images.
I'm including a warning in the documentation, making clear that only local images ca be optimized.
The Nuxt team is planing to include a core feature where external images can be optimized, but I don't know if it will include all the features from nuxt-optimizes-images.
I'm figuring out to support external images with this module, but I have not yet found a reliable solution. If you have a recommendation or an idea of how to approach this, please open a feature request. Thanks 😎
There is a work in progress nuxt image module with support for optimized external images.
how to make nuxt-optimized-images work with this package? https://www.npmjs.com/package/nuxt-image-extractor
No wonder I don't see anything happening in my project :D