tags:

views:

47

answers:

2

HI I do have image files in directory which is downloaded from several resources.. if I do have name of that image then how can I check existence of the same with PHP

+6  A: 

is_file() checks whether the file exists.

EDIT: btw, getImageSize() tells you a lot about the image, if it is valid, parseable by your server, how big it is, what type of image, etc. It is said to be slower than some of the more specialized functions, but when this returns true, you can be sure that the image will be fully usable.

AndreasT
guess I should have provided a link as well ;))
AndreasT
AndreasT: Same thing counts for you ;) http://php.net/manual/en/function.is-file.php and http://php.net/manual/de/function.getimagesize.php. I support the use of getImageSize.
danilo
+2  A: 

file_exists()

Mark Baker
file exists sound intuitive, but it also returns true if you feed it a directory name...
AndreasT
True, but very few people will give directories an extension of .gif or .jpg or .png; and most people checking for the existence of an image file will be testing against something with one or other of those extensions
Mark Baker
dude.. I've seen things...
AndreasT