Asperon Posted November 21, 2007 Share Posted November 21, 2007 how do you access fonts for GD use? I know locally you use your windows directory to your fonts folder, but online, how do you access true type fonts? thank you **freetype 2 is enabled, but how do I access it with imagefttext(), how do you call the font? Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/ Share on other sites More sharing options...
Daukan Posted November 21, 2007 Share Posted November 21, 2007 You put in were ever you want to. I usually put them in there own directory within my image directory. You put the path to the font in your script. If you are using imagettftext() you would put the path in there. Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395563 Share on other sites More sharing options...
Asperon Posted November 21, 2007 Author Share Posted November 21, 2007 do I copy the font from my fonts folder on in my C drive and put them there? for the imagettftext() or if freetype is enabled, is there already set path to call the fonts. and is there a command where I can see what fonts freetype has avail? Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395565 Share on other sites More sharing options...
Daukan Posted November 21, 2007 Share Posted November 21, 2007 I copy them from my drive to my server to be use by php. Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395566 Share on other sites More sharing options...
Asperon Posted November 21, 2007 Author Share Posted November 21, 2007 I tried putting the font files on my server and using them, but to no avail, maybe my paths are messed up Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395570 Share on other sites More sharing options...
Daukan Posted November 21, 2007 Share Posted November 21, 2007 Here is an example from a captcha I've written, The font is in the same directory as the script <?php //iimagettftext ( resource $image, float $size, float $angle, int $x, int $y, int $color, string $fontfile, string $text ) imagettftext($captcha,rand(16,22),$rotangle,($i*$spacing),30,$textcolor,'/arial.ttf',substr($capstr,($i-1),1)); ?> Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395574 Share on other sites More sharing options...
Asperon Posted November 21, 2007 Author Share Posted November 21, 2007 thanks, I got it working, only now, if I save the image via imagepng($im,$loctaion) where $location='images/'.$imageName.'.png'; it won't save the image in the folder, this works on my localserver though Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395581 Share on other sites More sharing options...
Daukan Posted November 21, 2007 Share Posted November 21, 2007 Make sure the directory has the correct permissions Link to comment https://forums.phpfreaks.com/topic/78169-gd-fonts/#findComment-395582 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.