PHP get QQ Avatar and display the method
Recently saw the blog post the avatar a bit awkward, because the visitor's avatar is the same head, looking not very comfortable. Although the majority of the theme now integrates the Gavatar avatar function, do not say Gavatar was the wall of the problem, I do not now have a gavatar avatar.
Because I landed a few times, the connection speed is very slow, so I gave up, of course, the message plugin also abound, for example, now more fire more say, but for not registered more said friends, Avatar is still a problem, for many said social account binding, I test many times, QQ, everyone these mainstream platform bindings often error, And some friends hate the cumbersome authorization.
In view of this, I am thinking of a popular, relatively simple method, I think of a friend who has no avatar to call their QQ avatar, because QQ is now at least one hand, so only need to fill in the message when the QQ number, and then call its avatar, so it is more convenient.
The first is to get the head of QQ, this is the first step of the idea, that is, the theme of today.
The first method, the code is as follows:
The code is as follows:
$QQ = 123456789;
Echo ';
?>
The second method, the code is as follows:
The code is as follows:
$QQ = 552452006;
$SRC = ' http://q1.qlogo.cn/g?b=qq&nk= '. $qq. ' &s=100&t= '. Time ();
Header (' content-type:image/png ');
$res = imagecreatefromstring (file_get_contents ($SRC));
Imagepng ($res);
Imagedestroy ($res);
?>
The difference between the two methods:
The advantage of the first method is that you can output the original picture, if your avatar is a dynamic gif, then the output is also a dynamic graph, the disadvantage is that the speed is relatively slow, not suitable as a method to call the avatar.
The advantage of the second method is that it is faster than the first, but only the static diagram of the avatar is captured, and the dynamic avatar is not displayed, which is more suitable as a method to call the avatar.
http://www.bkjia.com/PHPjc/931946.html www.bkjia.com true http://www.bkjia.com/PHPjc/931946.html techarticle PHP get QQ Avatar and display the method recently see blog message avatar a bit awkward, because the visitor's avatar is the same head, looking not very comfortable. Although most of the themes are now ...