About Technique
HTTP protocol has really cool methods such as HEAD. HEAD method allows you to get only head data instead of head and body. Head data contains mimetype of the body, so we can rely on it to detect if it's really an image. Let's get it with JavaScript...The Code
Sync Example
Async Example
As you can see, you can even detect huge images very quickly. ;)
Originally posted at https://coderwall.com/p/qdg71a/detecting-if-an-image-is-really-an-image
No comments:
Post a Comment