Closed colbyfayock closed 12 months ago
Hey @colbyfayock
I have added this feature for 2.1.0 so that we can add it while adding a support for CldOgImage.vue
component as another feature as I dont think that it is necessary for stable 2.0.0 release.
I also don't have an account in Cloudinary that allows me to use remove background. Could you btw create one that could be used by this module for testing and playground? :)
sounds good. DMed you about the cloudinary account to handle that
Is your feature request related to a problem? Please describe.
When using transformations like background removal (
removeBackground
), Cloudinary will first return a 423 indicating that the image is processing. This is only going to happen the first time, when someone first kicks it off (or hits it during this process), but once complete, the image will be served as normal.Something that is a nice convenience that i did in Next Cloudinary was poll for the image on error, so that upon returning a 2XX response, I can then refresh the image to show up in the page.
This is certainly a nice to have, but it's a nice way of allowing that first person hitting the image to get the image eventually
Describe the solution you'd like
Here's how I did it in NExt Cloudinary: https://github.com/colbyfayock/next-cloudinary/blob/a8077a37d5a4e4847d75f57756dbe10231fe7d59/next-cloudinary/src/components/CldImage/CldImage.tsx#L81
The Image component has an onError handler, so once that fires, we try to hit the image again (since the onError doesnt provide status), check that status, and act depending on that, whether to continue polling, or refresh the component key to force re-render.
Not sure if Nuxt has an onErorr handler, but could also do this with native browser APIs if this is something interesting to work on.
Describe alternatives you've considered
Just letting it fail. It will only be the first person + anyone hitting it until it processes, after that it will load fine.