Forum Moderators: coopster

Message Too Old, No Replies

Probelm simple image created with GD

script of few row, work great x 1 year and now create bad image :'(

         

webstyler

7:46 am on May 3, 2006 (gmt 0)

10+ Year Member



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

Script is really simple:

//================================================
$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

[edited by: coopster at 11:23 am (utc) on May 3, 2006]
[edit reason] no personal urls please [/edit]

whoisgregg

1:12 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is "bad" about the generated image? More details on the failure will help others to provide accurate assistance.

webstyler

1:23 pm on May 3, 2006 (gmt 0)

10+ Year Member



:(
I have post url to image ok and to image bad but is been removed

without this is difficult to explain problem

?

whoisgregg

1:29 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it's difficult to explain problem, it will be difficult for anyone to suggest a fix. :) Give it a try, any information is helpful.

whoisgregg

1:59 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the sticky. I agree that is hard to describe.

ssuming that the font file hasn't changed, the handling of anti-aliasing has changed. The image is still generated, but the inside corners of text have an extra pixel filled in.

Try changing a few settings to see how that effects your output:

First, toggle the negative color value (which determines if GD uses antialiasing):

imagettftext($im, 8.5, 0, 14, 13, $color, "asimo.ttf", $_POST['name']); 

Next, switch to a different font size. Specifically an integer rather than a float:

imagettftext($im, 8, 0, 14, 13, -$color, "asimo.ttf", $_POST['name']); 

Finally, confirm your font file is the correct one. Upload a new file (get it from the source, not a backup) and call that one instead.

imagettftext($im, 8, 0, 14, 13, -$color, "asimo2.ttf", $_POST['name']); 

I realize these are more troubleshooting tips than a solution, but at least it gets you going in the right direction. I've not experienced this particular problem, so I can't provide better info.

webstyler

2:19 pm on May 3, 2006 (gmt 0)

10+ Year Member



:(

thks but .. nothing

whoisgregg

2:53 pm on May 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm afraid the issue is probably related to a change at your host/server configuration. Do you know if they have updated/changed the GD or PHP version(s) lately?

webstyler

3:01 pm on May 3, 2006 (gmt 0)

10+ Year Member



yes, off course

gd is =

php is newer version, but config seems =

:/