If the content type of a page is an image, how reliable is it that the headers will actually indicate that it is an image? Should I use this as the sole method for determining if a page (URL) is an image?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The good news is that I've usually seen images with the wrong Content Type more often than I've seen non-images with the image Content Type. So I would that the "image" Content Type is a pretty good indicator.
I'm curious though. If you're already going through the trouble of requesting a resource, what's the big deal with downloading the whole thing to test if it's an image?