Different textcolor on webserver as on local one

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Alyx
Forum Newbie
Posts: 2
Joined: Sat Sep 20, 2003 8:04 am

Different textcolor on webserver as on local one

Post by Alyx »

I've got programmed a little signature script for DAoC (Dark Age of Camelot) which shall add text on a predefined JPG, which is stored in the script's directory. The text shall be WHITE and on my local Apache server it also is as intended, but if I let the script run on the webserver it's has some purple touch.

Here the relevant code:

Code: Select all

$sig = ImageCreateFromJPeg($fname);

	$namecolor  = ImageColorAllocate($sig,0xFF,0xFF,0xFF);

	function imagestringb($arg1,$arg2,$arg3,$arg4,$arg5,$arg6)
	{
		imagestring ($arg1,$arg2,$arg3,$arg4,$arg5,$arg6);
		imagestring ($arg1,$arg2,$arg3+1,$arg4+1,$arg5,$arg6);
	};	

	imagestringb ($sig, 4, 80,65,  $realmrank, $namecolor);
	imagestringb($sig, 4, 80,80,  dotted($rpatall)." RP gesamt", $namecolor);
	imagestringb($sig, 4, 80,95,  dotted($lastweekrp)." RP letzte Woche", $namecolor);

	header("Content-type: image/png");
	ImagePng($sig);
	ImageDestroy($sig);
	exit;
I've seen some code in which someone first creates a true color image, then loads the JPeg and copies the JPeg into the self created one... which worked on the local server as before, but on the webserver the script didn't work then anymore at all... possibly because of memory limitations of the provider.

Who can help me out, thanks.

Alyx

p.s. The matter that I output it now as PNG is not the reason, as JPG there was the same problem, I just hoped using PNG might help.

p.p.s. The buggy result:
http://www.spacehub.de/sigtest/signatur ... name=Alyci
Alyx
Forum Newbie
Posts: 2
Joined: Sat Sep 20, 2003 8:04 am

Post by Alyx »

Hm... really nobody who can help? The provider is the German one purgetec / 1&1 by the way.

Alyx
tylerdurden
Forum Commoner
Posts: 66
Joined: Mon Jul 28, 2003 11:52 am
Location: Austria

Post by tylerdurden »

Working on it, gimme some time ;-)

You mean the text where it says Silberhand 6L4
1,32 ... gesamt etc??

Seems to be pure white. Photoshop says the same. Did you change something?
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

take the background JPEG, sling it into your favourite editor and resave it as zero compression truecolour (you may need to raise the number of colours first).

the non white would be because white doesn't appear in the palette of the image you are using as a base - as that palette is mimiced no further indices can be added so the GD process defaults to the closest colour.

I'd advise (once you have your image as a non compressed truecolour jpeg) converting it to either .gd or .gd2 file format and using the native functions.
Post Reply