Two ways to get QQ avatar from PHP

Source: Internet
Author: User
Tags header

Use PHP to get the QQ avatar two ways to share.

Method One:

$qq =12345678;
Echo '  ';

Method Two:

$qq =12345678;
$SRC = ' '. $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 method is that the original image can be output, if your avatar is a dynamic gif, then the output is also a dynamic diagram. The disadvantage is that the speed is slow, not suitable as a way to call the avatar.

Method Two advantage is compared with the first speed is relatively fast, but only grasp the head of the static diagram, will not display dynamic avatar, more suitable as a way to call the avatar.

Articles that you may be interested in

    • PHP in front of quotes to add the reason for the backslash and PHP to remove the backslash, three ways to turn off the PHP magic quotes
    • PHP with header () implementation file download, download the file hint is broken can not open the solution
    • PHP get today tomorrow yesterday timestamp of the N-way summary
    • PHP empty (delete) files in the specified directory, do not delete the Directory folder method
    • PHP implementation of the same server with multiple two-level domain share session data
    • PHP Analysis file header information to determine the type of upload file
    • Three ways to get a client's real IP address from PHP
    • How PHP clears HTML formatting and removes spaces from text and then intercepts text

Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.