doujing2497
2010-05-30 17:47
浏览 46
已采纳

使用PHP检查目录中是否存在图像文件

I have image files in a directory which have downloaded from several resources.

If I have the name of an image, how can I check its existence using PHP?

图片转代码服务由CSDN问答提供 功能建议

我在目录中有多个资源下载的图像文件。

如果我有图像的名称,我如何使用PHP检查它的存在?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanjian4150 2010-05-30 17:49
    已采纳
    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • douhuireng4407 2010-05-30 17:49

    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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题