By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,938 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,938 IT Pros & Developers. It's quick & easy.

imagettftext problem

P: n/a
My url is www.aptitudehack.com

Hi i cant get an image to display on another server though it does on
mine. Here is the code for the page. The problem i think is the
imagettftext function particularly the reference to my font file
"Verdana". If i use a different function to write text it does so no
bother but unfortunately i need this function to work. Here is the
error it outputs followed by the code for the page in question:
The image "http://www.aptitudehack.com/imagepage.php" cannot be
displayed, because it contains errors.
<?php

// Define .PNG image
header("Content-type: image/png");
$imgWidth=575;
$imgHeight=175;

// Create image and define colors
$image=imagecreate($imgWidth, $imgHeight);
$colorWhite=imagecolorallocate($image, 255, 255, 255);
$colorRed=imagecolorallocate($image, 255, 0, 0);

//label y axis
imagettftext($image, 7, 0, 22, 110, $colorRed, 'Verdana', 'results');
//this should output the word results

// Output graph and clear image from memory
imagepng($image);
imagedestroy($image);
?>

//the font file is definitely in the same directory

May 16 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Carved in mystic runes upon the very living rock, the last words of
monomaniac21 of comp.lang.php make plain:
My url is www.aptitudehack.com

Hi i cant get an image to display on another server though it does on
mine. Here is the code for the page. The problem i think is the
imagettftext function particularly the reference to my font file
"Verdana". If i use a different function to write text it does so no
bother but unfortunately i need this function to work. Here is the
error it outputs followed by the code for the page in question:

The image "http://www.aptitudehack.com/imagepage.php" cannot be
displayed, because it contains errors.


I get a 404 at that URL. That would definitly not be a valid PNG image.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
May 16 '06 #2

P: n/a
sorry wrong url

May 17 '06 #3

P: n/a
Carved in mystic runes upon the very living rock, the last words of
monomaniac21 of comp.lang.php make plain:
sorry wrong url


Well, it's kind of hard to figure out what the problem is, then.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
May 17 '06 #4

P: n/a
alan could i mail you the page and you could see if it works on your
server?

May 17 '06 #5

P: n/a
Carved in mystic runes upon the very living rock, the last words of
monomaniac21 of comp.lang.php make plain:
alan could i mail you the page and you could see if it works on your
server?


Have you tried loading the script, on the non-working server, directly?
That is, type the URL in your address bar, rather than putting it in an IMG
tag. See what it outputs.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
May 17 '06 #6

P: n/a
yeah it outputs what i wrote earlier. No worries though im just gonna
have to rewrite the script using the slightly uglier imagestring
function instead. thanks for the help though alan i appreciate it.

May 19 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.