How to speed up the download speed when getting (downloading) QQ avatar is very slow?

WBOY
Release: 2016-07-06 13:51:29
Original
1656 people have browsed it

Opening the link directly shows that it is very fast, but downloading or obtaining information online is very slow. How can I speed it up?

<code class="php"><?php
$url = "http://q.qlogo.cn/qqapp/101327045/D560BE9F90D5B2529BD75F976DDB628C/100";
$t1 = time();
var_dump(@getimagesize($url));
$t2 = time();

echo "<img src='$url'  />";
echo $t2-$t1."秒";

?>
</code>
Copy after login
Copy after login

The following is the running result (it took 17 seconds, which is unbearable)
How to speed up the download speed when getting (downloading) QQ avatar is very slow?

I want to download this picture and rename it to jpg format

Reply content:

Opening the link directly shows that it is very fast, but downloading or obtaining information online is very slow. How can I speed it up?

<code class="php"><?php
$url = "http://q.qlogo.cn/qqapp/101327045/D560BE9F90D5B2529BD75F976DDB628C/100";
$t1 = time();
var_dump(@getimagesize($url));
$t2 = time();

echo "<img src='$url'  />";
echo $t2-$t1."秒";

?>
</code>
Copy after login
Copy after login

The following is the running result (it took 17 seconds, which is unbearable)
How to speed up the download speed when getting (downloading) QQ avatar is very slow?

I want to download this picture and rename it to jpg format

This is equivalent to downloading twice. Depending on the speed of your server, it will definitely be slower.

Since you want to get the size, size, and format of the image. Instead of using php, you can just use js to get it. In this way, the calculations are all done on the client side.

If you use this function to obtain remote image information, it will be slower.
You can try to get it with get_file_content first, save it locally and then imagegetsize to see if it can be faster.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template