在php中有效替代getimagesize()

kam*_*lot 3 php performance image http

可能重复:
在php中超级快速getimagesize

我想获得网页中所有图像的图像大小(因此所有img标签)

问题是PHP的getimagesize()功能效率很低.

我试过这个......

for($i=0;$i<55;$i++){
  getimagesize('http://www.blackcommentator.com/265/265_images/265_cartoon_do_something_now_bill_large.jpg');
}
Run Code Online (Sandbox Code Playgroud)

..并且花了很长时间才完成.

我想知道是否有人知道一个更有效的替代品getimagesize(),以便在使用PHP获取大小的图像时,通常可以获得20-30张图像的大小.

Tim*_*Tim 6

使用curl保存图像,而是运行curl在请求并行 -这种方式将加载更快(瓶颈不是带宽,它的建立请求的时间,所以这将帮助).将图像保存到本地目录后,运行getimagesize()所有图像.