I want to check programmatically if image exists on the given URL. I am trying to get the image size and it would be great if I can store the response into variable by using getimagesize("http://my.cdn.com/5147.jpg")
.
If image exists I get the image size, but if it doesn't I get an error failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
. How can I get something like boolean false
if it failed to open stream?