PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Nov 21, 2019 6:10 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Fonts with GDLIB
PostPosted: Mon Feb 18, 2008 11:57 pm 
Offline
Forum Newbie

Joined: Mon Feb 18, 2008 11:52 pm
Posts: 9
Hello All,


Am using below code :

header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);

Given above code I can not change Font Face what I can do is to change font size from 1 to 5 only.
How to go about it if I want to use different Font Face i.e. Verdana, Arial Rounded or it could be anything. I am using PNG images.


Top
 Profile  
 
 Post subject: Re: Fonts with GDLIB
PostPosted: Fri Mar 07, 2008 4:37 pm 
Offline
Jedi Mod
User avatar

Joined: Tue Dec 21, 2004 6:03 pm
Posts: 5263
Location: usrlab.com
imagestring() is pretty awful for switching fonts. Try imagettftext() instead, that will let you use TTF fonts (any Windows font basically). You do need to have Postscript compiled into GD but most hosts have it, as does the standard PHP installer if you're working locally.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group