I have image generator that sometimes fails and sends a error in text/html while the Status is still 200.
What is the best way to reload the image from the same url if the content-type is not image/jpeg. Should I approach this in a separate php file with curl headers and reload if it's not image/jpeg or is it possible to do on client side in javascript/jquery?