duanhuau567787 2010-07-29 11:25
浏览 8
已采纳

我可以用任何方式检查url是否指向有效图像(使用JS / PHP / ZendFramework)?

i am developing a test/learning app. i wonder how can i test if an image from another site/domain ... i broke up my validation logic to the following

  • exists
  • is an image
  • is of valid type
  • is of a specific dimensions
  • is below a max size - say i want the image to load quickly. tho the hosting resource is not mine.
  • 写回答

2条回答 默认 最新

  • douchuang4402 2010-07-29 11:27
    关注

    getimagesize() can do all but the last of your points. For that you can use filesize(). For filesize() you'll have to actually download it though, but seeing as getimagesize() also requires that, you can just save it to a temporary file. You can use tempnam() to get a temporary file that doesn't conflict with others.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效