php----头像上的马赛克

来源:互联网 发布:python 转换成数字 编辑:程序博客网 时间:2024/05/17 07:01
function pixelfuck($url, $chars='ewk34543§G§$§$Tg34g4g', $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+=$shrpns)              imagestring($img,$weight,$x*$size,$y*$size, $chars{@++$p%$cc}, imagecolorat($resource, $x, $y));      return $img;  }    $url = 'http://upload.wikimedia.org/wikipedia/commons/b/be/Manga_Icon.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));  
0 0
原创粉丝点击