| | |
Convert a string into an image?
![]() |
The GD Library will alow you to add text to an image, the GD library can be obtained from http://www.libgd.org/Main_Page
•
•
Join Date: Sep 2008
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
Does anyone know if there's a function in php that will allow me to convert a string into an image?
bool imagestring ( resource image, int font, int x, int y, string string, int color )
<?php
// create a 100*30 image
$im = imagecreate(100, 30);
// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
// write the string at the top left
imagestring($im, 5, 0, 0, "Hello world!", $textcolor);
// output the image
header("Content-type: image/png");
imagepng($im);
?>
once refer these links:
http://www.rafaeldohms.com.br/2008/0...e-with-php/en/
http://www.developertutorials.com/tu...620/page1.html
or try this:
http://www.rafaeldohms.com.br/2008/0...e-with-php/en/
http://www.developertutorials.com/tu...620/page1.html
or try this:
php Syntax (Toggle Plain Text)
<?php $image = ImageCreateFromPNG("base.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'arial.ttf'; $fontSize = "10"; $fontRotation = "0"; $str = "Example of GD in PHP. Date: " . date("m-j-Y g:i:s (a)"); /* Shadow */ ImageTTFText($image, $fontSize, $fontRotation, 7, 22, $colorShadow, $font, $str); /* Top Level */ ImageTTFText($image, $fontSize, $fontRotation, 5, 20, $color, $font, $str); header("Content-Type: image/PNG"); ImagePng ($image); imagedestroy($image); ?>
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
![]() |
Similar Threads
- Help Resizing Image, PLEASE!! (C#)
- Converting byte array into string (ASP.NET)
- how to add watermark in image (C#)
- image not displayed in datalist (ASP.NET)
- Example of Image Upload (ASP.NET)
- Convert an image to *.ico format (Java)
- image manipulation (C#)
- error C2664: cannot convert parameter 1 from 'float **__w64 ' to 'float *' (C)
- Quality (Java)
Other Threads in the PHP Forum
- Previous Thread: Can't delete Record PHP MySQL
- Next Thread: ttf font uploading problem?
Views: 3366 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess ajax apache api archive array arrays beginner binary broken cakephp check checkbox class classes cms code combobox cron curl database date development directory display download dynamic echo email error file files folder form forms function functions google header hosting htaccess html image include insert ip java javascript joomla jquery limit link list login loop mail mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio recursion regex remote results rewrite script search select server sessions sms source space speed sql storage syntax table tutorial unicode update updates upload url user validation validator variable video web xml






