Problem with image created with GD

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

Problem with image created with GD

Post by webstyler »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi to all 

We have a script that create a "button" image with gd
This script use our ttf upload online, in script dir

All work great ok for 1 year, now the image created is bad.
Seems they have antialiasing but this is set 0

Correct Image:[url]http://www.webstyler.it/public/ok.gif[/url] 
Bad Image:[url]http://www.webstyler.it/public/ko.gif[/url]

Script is really simpe:

Code: Select all

//================================================
$im = ImageCreateFromGif('base.gif');
$color = ImageColorAllocate($im,255,255,255);
imagettftext($im, 8.5, 0, 14, 13, -$color, "asimo.ttf", $_POST['name']);
$file_pulsante="$dirsharefile/".$pulsante.".gif";
Imagegif($im,$file_pulsante);
ImageDestroy($im);
//================================================


Thks :)


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

Post by webstyler »

:'(

we have try all but not solutions founded

help pls

ps. sorry x bad syntax on my prev post :)
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Moved to PHPGD.com forum.
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

Post by webstyler »

thks
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Firstly, what is -$color supposed to do? I can't see a reason for the -.

Secondly, are you switching antialiasing off? You're not using the imageantialias() function at all..

Thirdly, has anyone changed GD at all? In particular, have they upgraded the freetype library to enable font hinting? I think the problem is that the font you're using is actually supposed to look like the "bad" gif, but until now GD hasn't been using it's hinting values so it's looked like the old gif. (Bit of a guess there though..)
webstyler
Forum Commoner
Posts: 85
Joined: Sat Feb 14, 2004 2:16 am

Post by webstyler »

onion2k wrote:Firstly, what is -$color supposed to do? I can't see a reason for the -.
http://www.php.net/manual/en/function.imagettftext.php
"Using the negative of a color index has the effect of turning off antialiasing"
onion2k wrote: Secondly, are you switching antialiasing off? You're not using the imageantialias() function at all..
..uhm
I've used - on imagegetftext
but I can try to add imageantialias
onion2k wrote:
Thirdly, has anyone changed GD at all? In particular, have they upgraded the freetype library to enable font hinting? I think the problem is that the font you're using is actually supposed to look like the "bad" gif, but until now GD hasn't been using it's hinting values so it's looked like the old gif. (Bit of a guess there though..)
Gd is the same versione, php is been upgraded
how can I check if hosting service have upgraded the freetype library to enable font hinting ?

thks
Post Reply