When we fetch images from a remote server, the success of the request depends, in part, on the remote server's availability and stability.
In case such disruptions occur, images can get truncated and appear broken when served.
We can configure your account to return a boolean parameter named
IsCorrupt so when uploading while also setting the
image_metadata parameter as
true, we'll return that parameter as part of the upload response.
Then, you can apply your logic to re-upload the image while overwriting the existing corrupted image -
upload_response = cloudinary.uploader.upload(<FILE>,image_metadata=True) if upload_response['image_metadata']['IsCorrupt']: print "Corrupted image, retrying..." upload_response = cloudinary.uploader.upload( < FILE >,image_metadata=True, overwrite=True)
If you’d like to retrieve this parameter in your responses (currently for paid plans only), please contact us at firstname.lastname@example.org :)