note 76663 added to function.imagecreate
| From: | SohelTaslim at osu1 dot php dot net | Date: | Wed, 25 Jul 2007 07:22:13 +0000 |
| Subject: | note 76663 added to function.imagecreate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128905@lists.php.net to get a copy of this message | ||
It is easy and simple example to convert Text to Image with selected font.
It helps me to display Bangla text as image when users have no installed bangla font.
I hope it can help you too!
<?php
//Kip the font file together or write proper location.
makeImageF("Life in PHP.","CENTURY.TTF");
function makeImageF($text, $font="CENTURY.TTF", $W=200, $H=20, $X=0, $Y=0, $fsize=18,
$color=array(0x0,0x0,0x0), $bgcolor=array(0xFF,0xFF,0xFF)){
$im = @imagecreate($W, $H)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, $bgcolor[0], $bgcolor[1], $bgcolor[2]); //RGB color
background.
$text_color = imagecolorallocate($im, $color[0], $color[1], $color[2]); //RGB color text.
imagettftext($im, $fsize, $X, $Y, $fsize, $text_color, $font, $text);
header("Content-type: image/gif");
return imagegif($im);
}
?>
----
Server IP: 61.195.146.164
Probable Submitter: 210.251.252.137
----
Manual Page -- http://www.php.net/manual/en/function.imagecreate.php
Edit -- https://master.php.net/note/edit/76663
Del: integrated -- https://master.php.net/note/delete/76663/integrated
Del: useless -- https://master.php.net/note/delete/76663/useless
Del: bad code -- https://master.php.net/note/delete/76663/bad+code
Del: spam -- https://master.php.net/note/delete/76663/spam
Del: non-english -- https://master.php.net/note/delete/76663/non-english
Del: in docs -- https://master.php.net/note/delete/76663/in+docs
Del: other reasons-- https://master.php.net/note/delete/76663
Reject -- https://master.php.net/note/reject/76663
Search -- https://master.php.net/manage/user-notes.php