note 53548 added to function.imagealphablending
| From: | JakubArgasi�ski at osu1 dot php dot net | Date: | Sun, 05 Jun 2005 18:53:42 +0000 |
| Subject: | note 53548 added to function.imagealphablending | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89970@lists.php.net to get a copy of this message | ||
I have been looking around for a while to find a script which does the following: generates image
with text using specified font with given color, but with totally transparent background (by
alpha-channnel, not via color transparency). Finally, I have created the script by myself. It's
just a rough idea how to do it.
<?php
$tekst = "This is a test message\nza¿ó³æ gê¶l± ja¼ñ!\nZA¯Ó£Æ GʦL¡
JA„?";
$h = 9;
$size = imageTTFBBox($h, 0, "arial.ttf", $tekst);
$image = imageCreateTrueColor(abs($size[2]) + abs($size[0]), abs($size[7]) + abs($size[1]));
imageSaveAlpha($image, true);
ImageAlphaBlending($image, false);
$tlo = imagecolorallocatealpha($image, 220, 220, 220, 127);
imagefill($image, 0, 0, $tlo);
$napis = imagecolorallocate($image, 220, 220, 220);
imagettftext($image, $h, 0, 0, abs($size[5]), $napis, "arial.ttf", $tekst);
imagepng($image, "output.png");
imagedestroy($image);
?>
<html>
<head>
</head>
<body bgcolor="#808080">
<img src="output.png" alt="">
</body>
</html>
----
Manual Page -- http://www.php.net/manual/en/function.imagealphablending.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53548
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53548&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53548&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53548&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53548&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53548&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53548&report=yes
Search -- http://master.php.net/manage/user-notes.php