Getting the MD5 of a transformed 'fetch' image.
I need to validate the image stream of a fetched (and transformed) image. After retrieving a fetch image, can I obtain an MD5 of the image from (presumably the cached CDN image that has had the transforms applied) to compare with the MD5 I am calculating on the receiving end in order to verify the reception of the transformed fetch image?
Step 1: I get the image using the image fetch URL. The image is fetched by Cloudinary from a URL, the transforms are applied and the image is cached in the CDN.
Step 2: I make an admin request to Cloudinary for information about the cached image in order to obtain the MD5 calculated by Cloudinary of the image in the CDN cache.
Step 3: Compare Cloudinary's cache MD5 with my locally computed MD5 to verify that the image arrived correctly.
How do I do Step 2?
-
Hi,
I apologize for the delay.
The etag is equivalent of the MD5 signature of the uploaded image.
Unfortunately, this information isn't stored on our side and therefore is recalculated for every image on demand. That is also why it's not returned in any admin request.HEAD request will work for you best, especially as it will hardly consume bandwidth and will provide much faster results.
0 -
I am computing the MD5 of the image stream from the fetch URL and also getting the "etag" from the header variables of a HEAD call to the same URL. These values are always different.
Looking at your response above [The etag is equivalent of the MD5 signature of the uploaded image.] Do you mean to say that the ETAG is NOT the MD5 of the image I am receiving (that is transformed) but is instead the original image *referenced* by the fetch URL?
I am needing the MD5 of the transformed image that I get from the fetch URL.
Either the ETAG is not that value OR the stream I am processing from the fetch URL is not exactly equivalent to the one used to compute the ETAG.
0 -
Hi,
The values should be the same from the MD5 and etag. Can you please open a support ticket at (https://support.cloudinary.com/hc/en-us/requests/new) and address it to me. Also, can you add the Cloudinary URLs examples you are calculating the MD5 signature for, and their associated md5 signature and etag.
I am looking forward to your ticket.
0 -
I did a standalone test of various methods of acquiring the MD5 (to test some black boxes in the process) and found an issue in third-party code that was the source of the issue. So no worries on your part.
I will note that the answer to my original question would have been and it bears repeating here for the next person looking into this:
Examine the header "etag" in the HTTP GET (or HTTP HEAD) of the resource and it will contain a quoted HEX MD5 value string of the transformed original image suitable for verifying the acquired image stream.
When using several common methodologies for acquiring an image from a URL/URI in Java, the header information is not supplied and was not apparent.
Thanks for your help.
0
Post is closed for comments.
Comments
4 comments