HOME       >>       Graphics, Design & Animation

Php Image


brouzine

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.


r3d1405241470

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


overture

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!


evilworm

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);?>


cryptwizard

<?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.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.