Jump to content


Photo

GD Image Help


  • Please log in to reply
10 replies to this topic

#1 Deserteye

Deserteye
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationNew Jersey

Posted 05 October 2006 - 02:12 AM

I need help on this script:

<?php

header ("Content-type: image/png");

$image = imagecreatefrompng("project.png");

$color = imagecolorallocate($image, 255, 255, 255);
$font = imageloadfont("verdana.ttf");
$string = "Text here";


imagestring($image, $font, 9, 10, $string, $color);

imagepng($image);
imagedestroy($image);

?>

It gives me an error saying there is something wrong with it. The problem is that when I try to load the font (imageloadfont()), thats when it gives me an error. But when I take the imageloadfont() function out, its ok but the font looks bad. So how do I load the verdana font?

What I know:
XHTML: 10/10
CSS: 8/10
JavaScript: 5/10
VBScript: 7/10 PHP: 8/10 MySQL: 9/10

#2 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 02:14 AM

Can you verify that the font exists?  Make sure it is case sensitive.

#3 brendandonhue

brendandonhue
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 05 October 2006 - 02:21 AM

imageloadfont() is expecting a .gdf file. You're probably looking for imagettftext().

#4 Deserteye

Deserteye
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationNew Jersey

Posted 05 October 2006 - 02:36 AM

imageloadfont() is expecting a .gdf file. You're probably looking for imagettftext().

I tried that as well and I got an error too.

Yes the verdana.ttf does exist.

What I know:
XHTML: 10/10
CSS: 8/10
JavaScript: 5/10
VBScript: 7/10 PHP: 8/10 MySQL: 9/10

#5 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 02:42 AM

is it verdana.ttf or Verdana.ttf?  You have said both now.

#6 Deserteye

Deserteye
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationNew Jersey

Posted 05 October 2006 - 02:45 AM

is it verdana.ttf or Verdana.ttf?  You have said both now.

what? its verdana.ttf yes

What I know:
XHTML: 10/10
CSS: 8/10
JavaScript: 5/10
VBScript: 7/10 PHP: 8/10 MySQL: 9/10

#7 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 02:49 AM

Do you get an error with the new function?  What is it?

#8 Deserteye

Deserteye
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationNew Jersey

Posted 05 October 2006 - 03:00 AM

Do you get an error with the new function?  What is it?

The image “http://www.thesite.com/project.php” cannot be displayed, because it contains errors.

What I know:
XHTML: 10/10
CSS: 8/10
JavaScript: 5/10
VBScript: 7/10 PHP: 8/10 MySQL: 9/10

#9 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 03:03 AM

If you try and navigate to the image, what error does that give you?

#10 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 03:05 AM

I bet that is when you navigate there, nevermind. 

Can you var_dump the result?

editI mean, catch what the imagettftext() is returning and var_dump that.

#11 brendandonhue

brendandonhue
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 05 October 2006 - 08:17 PM

Can we see the code you tried with imagettftext()?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users