Hey; I’m currently using the following way of checking whether an image exists on a server:
if (@getimagesize($s3url))
{
//do stuff
}
Needless to say, that’s hardly the most elegant way of doing that… But honestly, I don’t actually know where to start looking for a better solution.
I was wondering if perhaps it was possible to just send a request, receive a HTTP response (i.e. if the HTTP response is 200, carry on, if not, evaluate to false); but is that the best way?
What is the best function to check for the existence of an (image) file?
file_exists() then check whether the file really is an image or not using getimagesize()