PHP's getimagesize not detecting image from URL
<p>I'm using the following code to quickly verify whether a link is an image or not...</p>

<pre><code>if (getimagesize($imageLink)) {
} else {
    echo "notImage";
    exit();
}
</code></pre>

<p>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...</p>

<p><a href="http://s4.reutersmedia.net/resources/r/?m=02&amp;d=20160330&amp;t=2&amp;i=1128905435&amp;w=&amp;fh=545px&amp;fw=&amp;ll=&amp;pl=&amp;sq=&amp;r=LYNXNPEC2T0YW" rel="nofollow">http://s4.reutersmedia.net/resources/r/?m=02&amp;d=20160330&amp;t=2&amp;i=1128905435&amp;w=&amp;fh=545px&amp;fw=&amp;ll=&amp;pl=&amp;sq=&amp;r=LYNXNPEC2T0YW</a></p>

<p>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...</p>

<p><a href="https://d2sh4fq2xsdeg9.cloudfront.net/contentAsset/image/f9b79b5e-1986-4376-b9ed-0b153d6deb14/image/byInode/1/filter/Resize,Jpeg/jpeg_q/69/resize_w/434" rel="nofollow">https://d2sh4fq2xsdeg9.cloudfront.net/contentAsset/image/f9b79b5e-1986-4376-b9ed-0b153d6deb14/image/byInode/1/filter/Resize,Jpeg/jpeg_q/69/resize_w/434</a></p>

<p>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!!  </p>