PHP Interesting Avatar Puzzle

Source: Internet
Author: User
Tags resource

In the study of PHP's GD library, I found a piece of code written by others, here to increase your enthusiasm for PHP. The code mosaic of the code for the character's avatar looks interesting.


function Pixelfuck ($url, $chars = ' ewk34543§g§$§ $Tg 34g4g ', $shrpns =1, $size =4, $weight =2)
{
    list ($w, $h, $type) = GetImageSize ($url);
    $resource = imagecreatefromstring (file_get_contents ($url));
    $img = Imagecreatetruecolor ($w * $size, $h * $size);

    $CC = strlen ($chars);
    For ($y =0 $y < $h; $y + = $shrpns) for 
        ($x =0 < $x; $w + = $x)
            imagestring ($shrpns, $img, $weight * $x, $size *$ Size, $chars {@++ $p% $cc}, Imagecolorat ($resource, $x, $y));
    return $img;
}

$url = ' http://www.alixixi.com/program/UploadPic/2014-9/201493214416197.png ';
$text = ' I-dont-like-manga-...-why-do-they-have-such-big-eyes? Strange-...-what-want-you-do? ';

Header (' content-type:image/png ');
Imagepng (Pixelfuck ($url, $text, 1, 6));

The following one is the original image, one is the processed image.










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.