You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Nuxt/Image only seems to work fine with images that are presented at build time in ~/public. While that may suffice most static sites, for sites that require user interaction, including uploading media, this ends up breaking the images in production. It is not ideal to have to rebuild the app every time an image is uploaded, for quite obvious reasons.
Take for example this code:
// ~/server/routes/images/[image].get.tsexportdefaultdefineEventHandler({handler: async(event)=>{constimg=getRouterParam(event,"image")constimageStorage=useStorage("images")// this could, for example, be an FS driver configured in `nuxt.config.ts`if(awaitimageStorage.hasItem(img)){returnawaitimageStorage.getItem(img)}}})
This works fine when going to it on the browser, but Nuxt/Image fails to parse this when used in a element, with a message stating the file cannot be found.
It would be very beneficial to have the benefits of image optimization for images that are obtained dynamically through event handlers, as most SSR apps use this kind of functionality.
The text was updated successfully, but these errors were encountered:
Currently Nuxt/Image only seems to work fine with images that are presented at build time in
~/public
. While that may suffice most static sites, for sites that require user interaction, including uploading media, this ends up breaking the images in production. It is not ideal to have to rebuild the app every time an image is uploaded, for quite obvious reasons.Take for example this code:
This works fine when going to it on the browser, but Nuxt/Image fails to parse this when used in a element, with a message stating the file cannot be found.
It would be very beneficial to have the benefits of image optimization for images that are obtained dynamically through event handlers, as most SSR apps use this kind of functionality.
The text was updated successfully, but these errors were encountered: