FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP font's





garionw
I am currently trying to create a dynamic image that displays my latest blog post on the image so I can distribute it across other forums.

I would like to use the font arial but can't seem to get it to work under Frihost. When I place the font in, it gives me this error:

Quote:
The image “http://gwplus.net/signature2.png/index.php” cannot be displayed, because it contains errors.


Heres the current script I am using:

Code:

 $myImage = ImageCreateFromPng("garions_blog.png");

 $white = imagecolorallocate($myImage, 255, 255, 255);
 
 $string = "What I wan't will go here";

 imagettftext($myImage, 10, 0, 85, 85, $white, "arial.ttf", $string);

 header ("content-type: image/png");
 ImagePng($myImage);

 imagedestroy($myImage);
qscomputing
OK, I don't know that much about PHP or gd, but here are some suggestions:

1. Try a fully-qualified path to the font file.
2. See if you can get the image to output something without text.
3. Try a different font file.
4. Look to see if there is a method which will allow you to load the font and write the text seperately.
5. Add lots of echo statements between the lines of code to see where the error is.

HTH,
- QS.
garionw
qscomputing wrote:
1. Try a fully-qualified path to the font file.


Do you mean /user/garionw/gwplus/fonts/........? or just /fonts/?

qscomputing wrote:
2. See if you can get the image to output something without text.

Yes that works, and I can echo text into the image without a font (It comes up with Courier New (I think)

qscomputing wrote:
3. Try a different font file.

I'd like Arial, but also tried one that I downloaded off the internet and neither of them work. (It was the CNN one because I knew Bonding's wouldn't have that installed Razz

qscomputing wrote:
4. Look to see if there is a method which will allow you to load the font and write the text seperately.

Not quite sure what you meant there?

qscomputing wrote:
5. Add lots of echo statements between the lines of code to see where the error is.

I know its a part of that font function because the function without the font (Courier) work's perfectly.

Thanks for your help
Maxus
garionw wrote:
qscomputing wrote:
1. Try a fully-qualified path to the font file.


Do you mean /user/garionw/gwplus/fonts/........? or just /fonts/?

I just upload the font file and give the path. If you do it like this you can use every font, even if it's not on the server by default.
Manofgames
Maxus wrote:
garionw wrote:
qscomputing wrote:
1. Try a fully-qualified path to the font file.


Do you mean /user/garionw/gwplus/fonts/........? or just /fonts/?

I just upload the font file and give the path. If you do it like this you can use every font, even if it's not on the server by default.


But was it the full path ie: /user/manofga/domains/example.frih.net/public_html/fonts/arail.ttf ???

or fonts/arial.ttf ?

I'm having problems like this too.
Alie
Quote:
http://gwplus.net/signature2.png/index.php

Try the same link, but without index in the end. Can help... Like this:
Code:
http://gwplus.net/signature2.png


For image scripts formats like php in the end are unexeptable, but if you give signature2.png in the end - browser will automaticaly open this folder and read index.php.
garionw
Alie wrote:
Quote:
http://gwplus.net/signature2.png/index.php

Try the same link, but without index in the end. Can help... Like this:
Code:
http://gwplus.net/signature2.png


For image scripts formats like php in the end are unexeptable, but if you give signature2.png in the end - browser will automaticaly open this folder and read index.php.


Yes, I can display the image with no problems (There was one in my signature that did that same thing, but one of my image's was too large in size so I had to remove it) but it's reading the font that I can't get
Maxus
Manofgames wrote:


But was it the full path ie: /user/manofga/domains/example.frih.net/public_html/fonts/arail.ttf ???

or fonts/arial.ttf ?

I'm having problems like this too.

No, ex:
if it's in the same directory, just set path "./font.ttf"
this it worked fine with me
Related topics
survey Insert in Php
How To : Improve Your PHP Programming
form mail for php
Visitor notebook for php
Dynamic User Customizable Sites. CSS + PHP = Awesome!
Tutorial: PHP Installed Modules Dynamic Reference Tool
PHP Help Needed
PHP Tutorial: Basic Shoutbox w/ MySQL
uma grande dúvida em php, por favor me ajudem
PHP Login Problem
PHP image
PHP Font Trouble...
[PHP] Problem with Dynamic Sig's Font Color
looking for help with GD
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.