Jump to content

Archived

This topic is now archived and is closed to further replies.

Deserteye

GD Image Help

Recommended Posts

I need help on this script:

[code]<?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);

?>[/code]

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?

Share this post


Link to post
Share on other sites
[quote author=brendandonhue link=topic=110551.msg447036#msg447036 date=1160014862]
imageloadfont() is expecting a .gdf file. You're probably looking for imagettftext().
[/quote]
I tried that as well and I got an error too.

Yes the verdana.ttf does exist.

Share this post


Link to post
Share on other sites
[quote author=Hi I Am Timbo link=topic=110551.msg447049#msg447049 date=1160016179]
is it verdana.ttf or Verdana.ttf?  You have said both now.
[/quote]
what? its verdana.ttf yes

Share this post


Link to post
Share on other sites
[quote author=Hi I Am Timbo link=topic=110551.msg447055#msg447055 date=1160016549]
Do you get an error with the new function?  What is it?
[/quote]
The image “http://www.thesite.com/project.php” cannot be displayed, because it contains errors.

Share this post


Link to post
Share on other sites
I bet that is when you navigate there, nevermind. 

Can you var_dump the result?

[b]edit[/b]I mean, catch what the imagettftext() is returning and var_dump that.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.