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
views:
47answers:
2
+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
2010-05-30 17:49:36
guess I should have provided a link as well ;))
AndreasT
2010-05-30 19:32:23
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
2010-05-30 19:44:12
file exists sound intuitive, but it also returns true if you feed it a directory name...
AndreasT
2010-05-30 17:51:32
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
2010-05-30 17:55:48