brouzine 0 Report post Posted December 13, 2004 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. Share this post Link to post Share on other sites
r3d1405241470 0 Report post Posted December 13, 2004 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 Share this post Link to post Share on other sites
overture 0 Report post Posted December 15, 2004 i believe you need to use the ImageString() function. this is the link:ImageString()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! Share this post Link to post Share on other sites
evilworm 0 Report post Posted December 17, 2004 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);?> Share this post Link to post Share on other sites
cryptwizard 0 Report post Posted December 21, 2004 <?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 http://forums.xisto.com/no_longer_exists/ I have chose to use the pixel-like font which is the best looking out of the built-in ones. Share this post Link to post Share on other sites