BillyBoB Posted July 22, 2007 Share Posted July 22, 2007 I am building a php sig for my website. I am working to put a font on the text that is displayed. here is the code i have it works but no special text: <?php $username = substr($_GET[username],0,20); if(!$username) { $username = "None"; } header("Content-type: image/jpeg"); $im = ImageCreateFromJPEG("Untitled-2.jpg"); $txt_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 2, 65, 3, "$username", $txt_color); imageJPEG($im); ?> this is the code with a font loaded but it doesnt work: <?php $username = substr($_GET[username],0,20); if(!$username) { $username = "None"; } header("Content-type: image/jpeg"); $im = ImageCreateFromJPEG("Untitled-2.jpg"); $txt_color = imagecolorallocate($im, 255, 255, 255); $font = imageloadfont("pf_tempesta_five_condensed.ttf"); imagestring($im, $font, 65, 3, "$username", $txt_color); imageJPEG($im); ?> the working sig is shown at the bottom on my sig. Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 22, 2007 Share Posted July 22, 2007 image.php <?php header("Content-type: image/jpeg"); $im = ImageCreateFromJPEG("Untitled-2.jpg"); $txt_color = imagecolorallocate($im, 255, 255, 255); $font = imageloadfont("pf_tempesta_five_condensed.ttf"); imagestring($im, $font, 65, 3, "$username", $txt_color); imageJPEG($im); ?> test.php <?php $username = substr($_GET[username],0,20); if(!$username) { $username = "None"; } echo "<img src='image.php'></img>"; ?> Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 22, 2007 Author Share Posted July 22, 2007 could i ask what you just told me does???? looks no different except its added into 2 different codes Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 22, 2007 Share Posted July 22, 2007 you ansaw your own question two diffrent codes. useing img src Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 22, 2007 Author Share Posted July 22, 2007 sorry but that didnt work at all http://dreamshowstudios.net/test1.php Quote Link to comment Share on other sites More sharing options...
Barand Posted July 22, 2007 Share Posted July 22, 2007 replace $font = imageloadfont("pf_tempesta_five_condensed.ttf"); imagestring($im, $font, 65, 3, "$username", $txt_color); with imagettftext($im, 10, 0, 65, 13, $txt_color, 'pf_tempesta_five_condensed', $username) Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 22, 2007 Author Share Posted July 22, 2007 barand that didnt work but i figured out when you load a font it has to be in gdf format so i found a converter Quote Link to comment Share on other sites More sharing options...
Barand Posted July 22, 2007 Share Posted July 22, 2007 Is the ttf file in the same folder as the script? If not you need "path/to/fontfile/fontname.ttf" Quote Link to comment Share on other sites More sharing options...
BillyBoB Posted July 22, 2007 Author Share Posted July 22, 2007 yes its in the same folder Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.