English 中文(简体)
有效替代在 php[复制]内实现母乳喂养
原标题:Efficient alternative to getimagesize() in php [duplicate]
This question already has answers here:
Closed 10 years ago.

Possible Duplicate:
Super fast getimagesize in php

I want to get the image sizes of all the images within webpages (hence all img tags)

The problem is PHP s getimagesize() function is so inefficient.

I tried running this...

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

完成这项工作需要很长时间。

我很想知道,任何人是否知道比<代码>getimagesize()更高效的替代办法,以便在一个使用PHP的网页上获取图像大小,而这个网页的图像一般是接收20-30个图像。

最佳回答

使用<代码>curl/code>,以挽救图像,但操作curlparallel的要求——这样会更快地装载(瓶装不是带宽,而是打上了确定要求的时间,这样会帮助。 一旦您将图像保存到当地名录then<>>>>>>,就所有图像而言,可操作<代码>getimagesize(<>/code>。

问题回答

对开端人来说,在当地打着形象。 你在网络上重新宣传。 下载图像的间接费用大大超过了发现其宽度和高度的实际花费时间。

如果你再谈一下发现55个不同><>图像的大小,你可能会考虑把你的代码同起来。 你可能花费这么多的时间来建立链接,是你转让实际数据,而且由于在某个时候下载一个图像可能不会靠近你的互联网连接点,因此,通过同时开展两个进程,你的业绩就翻了一番。 在你停止看到业绩收益之前,继续增强一致性。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...