Test case:
toDataURL('http://vignette1.wikia.nocookie.net/clubpenguin/images/5/59/Cheese_Pin.png/revision/latest%3Fcb%3D20121229072939', {
callback: function(err, dataURL) {
...
}
});
CORS will block that request in the browser, but you can use something like cors-anywhere to get around that. The above results in a GET <image> 404 (Not Found), but it appears the host is using mod_rewrite or something similar to provide a placeholder image. I would like to be able to identify cases like that programmatically. It should be possible to refactor to-data-url to use XMLHttpRequest to get image data. That way, you could check the response status code and callback an error on non-2xx responses.
Test case:
CORS will block that request in the browser, but you can use something like cors-anywhere to get around that. The above results in a
GET <image> 404 (Not Found), but it appears the host is using mod_rewrite or something similar to provide a placeholder image. I would like to be able to identify cases like that programmatically. It should be possible to refactorto-data-urlto use XMLHttpRequest to get image data. That way, you could check the response status code and callback an error on non-2xx responses.