Two ways to get QQ avatar from PHP

Source: Internet
Author: User
Tags header advantage

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

Method One:

<?php
$qq =12345678;
Echo '  ';

Method Two:

<?php
$qq =12345678;
$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 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


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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.