note 86763 added to function.imagestring
| From: | keksnicoh at googlemail dot com | Date: | Sun, 02 Nov 2008 18:42:17 +0000 |
| Subject: | note 86763 added to function.imagestring | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146063@lists.php.net to get a copy of this message | ||
Some fun with imagestring:
This function is a product of too much time..
It opens an image and create a new image with one letter instead of a pixel.
<?php
error_reporting(E_ALL);
/**
* generates a image with chars instead of pixels
*
* @param string $url Filepath or url
* @param string $chars The chars which should replace the pixels
* @param int $shrpns Sharpness (2 = every second pixel, 1 = every pixel ... )
* @param int $size
* @param int $weight font-weight/size
* @return sesource
* @author Nicolas 'KeksNicoh' Heimann <www.salamipla.net>
* @date 02nov08
*/
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));
?>
Have fun :)
----
Server IP: 217.160.72.57
Probable Submitter: 80.171.62.168
----
Manual Page -- http://www.php.net/manual/en/function.imagestring.php
Edit -- https://master.php.net/note/edit/86763
Del: integrated -- https://master.php.net/note/delete/86763/integrated
Del: useless -- https://master.php.net/note/delete/86763/useless
Del: bad code -- https://master.php.net/note/delete/86763/bad+code
Del: spam -- https://master.php.net/note/delete/86763/spam
Del: non-english -- https://master.php.net/note/delete/86763/non-english
Del: in docs -- https://master.php.net/note/delete/86763/in+docs
Del: other reasons-- https://master.php.net/note/delete/86763
Reject -- https://master.php.net/note/reject/86763
Search -- https://master.php.net/manage/user-notes.php