Hello,I want to load text from a .txt file on the web and put it on to an image. How can I do that in php? Thanks.
i think it's possible, you have to use php gd and a bit more cleverness for your needs, hope someone have more time to create it for you
i believe you need to use the ImageString() function. this is the link:
I believe you will find the information that you need from there.
Hope it all goes well.
Show me the finished product if you manage to do it!
you will need gd with freetype and xpm.try some code like this:<?$img_number = imagecreate(350,22);$white = imagecolorallocate($img_number,255,255,255); $black = imagecolorallocate($img_number,0,0,0); $grey_shade = imagecolorallocate($img_number,204,204,204); $dark = imagecolorallocate($img_number,225,220,125); Imagettftext($img_number, 18,0,0,17,$dark,'/path/to/somefont.ttf',"image create text");header("Content-type: image/jpeg"); imagejpeg($img_number);?><?phpini_set('error_reporting', E_ALL);ini_set('display_errors', 1);header('Content-Type: image/png');$im = @imagecreate(250, 13) or die('Cannot Initialize GD Image');imageantialias($im, TRUE);$back = imagecolorallocate($im, 255, 255, 255);imagefill($im, 0, 0, $back);$text = imagecolorallocate($im, 0, 0, 0);imagestring($im, 2, 0, 0, ''.$_REQUEST['s'], $text);imagecolortransparent($im, $back);imagepng($im);imagedestroy($im);?>
Request it with something like: http://www.hugedomains.com/domain_profile.cfm?d=asdasf&e=com
If you are using Xisto, you can replace every occurance of png with gif as it is using PHP 4.3.9 which supports GIF.
My ISP doesn't, so thats why it has PNG.
A live demo is at
I have chose to use the pixel-like font which is the best looking out of the built-in ones.
|VIEW DESKTOP VERSION||REGISTER||GET FREE HOSTING|