data:image file not able to be processed as image
I have a file whose contents is really a data URI.
Example:
https://ipfs.io/ipfs/Qmbh6K2D5E3Kn9V21CTbPZ9t9pgfc5kmtsyoi6iXtnCQN9
If I copy and paste that content into my browser URL bar, I get the JPEG image displayed as expected.
I have a copy of this file on my S3 bucket which is backing my Cloudinary upload folder.
When I try to load it in Cloudinary, at
I get a 400 error:
"Failed to fetch remote resource for cache/1/62/3f/623fa0375aa45cd48247c201fc55401effdd1ff40faa593bfd16fb6b7d04ad69-MmQ5MGY0M2EtMjI2ZS00ZGI1LTgxMjItNWFmZTM2MGM5MzRl"
How can I get Cloudinary to process this file as an image so I can serve it to my customers?
Thanks!
-
Hi David,
I see that from your example you're using our Auto-Upload feature to allow Cloudinary to pull assets from your Cloudfront CDN which retrieves them from S3. Those files serve a text/plain content of Base64 strings.
For us to be able to grab the image from the remote source and store it in Cloudinary when using Auto-Upload, the actual image bytes need to be served back. Returning Base64 content will not work with Auto-Upload because the response will be text and therefore be rejected when attempted to be processed as an "image".
If you want to use Base64 to migrate assets to Cloudinary then that is possible, however, you would need to pass the Base64 String as the "file" parameter when calling the upload() method. In that case, we would take the Base64 and upload the contents of that as an image. You can ensure existing URLs work by passing the public_id parameter in the upload() call with a value for each image - in your example you would pass the public_id as "cache/1/62/3f/623fa0375aa45cd48247c201fc55401effdd1ff40faa593bfd16fb6b7d04ad69-MmQ5MGY0M2EtMjI2ZS00ZGI1LTgxMjItNWFmZTM2MGM5MzRl" and then your existing URL via Cloudinary would work.
Please try this out and let us know how it goes.
Post is closed for comments.
Comments
3 comments