note 69743 added to function.imagecreate
| From: | tc_ at anti dot gmx dot ch dot spam | Date: | Tue, 19 Sep 2006 11:50:42 +0000 |
| Subject: | note 69743 added to function.imagecreate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117307@lists.php.net to get a copy of this message | ||
Small piece of code to display a preview of a file in an image (usefull for thumbnail view of a
folder etc.)
<?php
$file = "test.txt"; //FILEADDRESS
$size = "100"; //IMAGE SIZE
$data = file($file);
$im = @ imagecreate($size, $size) or die();
$bc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
$lines = (int) $size / 10;
for ($t = 0; $t < $lines; $t++)
{
imagestring($im, 3, 4, 4, $data[$t], $tc);
imagestring($im, 3, 4, 4 + ($t * 10), $data[$t], $tc);
}
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?>
Maybe it will be usefull for somebody.
----
Server IP: 194.153.94.10
Probable Submitter: 194.40.201.2 (proxied: 1.1 Symantec_Web_Security (3.0.1.76))
----
Manual Page -- http://www.php.net/manual/en/function.imagecreate.php
Edit -- https://master.php.net/note/edit/69743
Del: integrated -- https://master.php.net/note/delete/69743/integrated
Del: useless -- https://master.php.net/note/delete/69743/useless
Del: bad code -- https://master.php.net/note/delete/69743/bad+code
Del: spam -- https://master.php.net/note/delete/69743/spam
Del: non-english -- https://master.php.net/note/delete/69743/non-english
Del: in docs -- https://master.php.net/note/delete/69743/in+docs
Del: other reasons-- https://master.php.net/note/delete/69743
Reject -- https://master.php.net/note/reject/69743
Search -- https://master.php.net/manage/user-notes.php