I'm using the following code to quickly verify whether a link is an image or not...
if (getimagesize($imageLink)) {
} else {
echo "notImage";
exit();
}
It works in practically all cases (i.e. if the browser returns an image, then getimagesize will return something), but I've found some cases where it doesn't work - e.g. for this link...
This applies generally to the reuters website and I'm sure a few others, but I'm really struggling to understand why there's this problem since the browser manages to return an image. I originally thought that getimagesize needed the path to the file explicitly stated (e.g. ending in .jpg, .png etc), but then again a link like this works fine...
Would really appreciate any thoughts from anyone having any ideas why getimagesize doesn't return an image in the first example but does in the second - and any suggestions on how to adapt the code to account for the reuters example would also be fantastic!!