PHP GD help |
Author: |
Message: |
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
RE: PHP GD help
hmm i always found that using the code below worked alot better for transparent backgrounds than the whole alpha blending thing. (use the below code after you create your image)
code: $tran = imagecolorallocate($image, 233,231,222);
$tran = imagecolortransparent($image,$tran);
imagefill($image,0,0,$tran);
This post was edited on 09-09-2005 at 02:46 PM by -dt-.
Happy Birthday, WDZ
|
|
09-09-2005 02:46 PM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
RE: PHP GD help
That will still cause the same hard-edges effect to any ttftext he adds...
Edit:
quote: Originally posted by Ezra
On the php.net pages it says I can't use imagesavealpha when imagealphablending is enabled
It woks on my sig, even If I place the text on the alpha sector.
This post was edited on 09-09-2005 at 02:53 PM by KeyStorm.
|
|
09-09-2005 02:48 PM |
|
|
Ezra
Veteran Member
Forgiveness is between them and God
Posts: 1960 Reputation: 31
37 / /
Joined: Mar 2003
|
O.P. RE: PHP GD help
Hmm, but I keep having a black background if I use a TrueColor image...
|
|
09-09-2005 03:07 PM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
RE: PHP GD help
Oh, sorry
it's colorallocatealpha($img,$r,$g,$b,$alpha)
|
|
09-09-2005 03:36 PM |
|
|
Ezra
Veteran Member
Forgiveness is between them and God
Posts: 1960 Reputation: 31
37 / /
Joined: Mar 2003
|
O.P. RE: PHP GD help
Still the black background
This is what I have now: (Not all of it, just the image part )
code: $im = imagecreatetruecolor($width, $height);
imagealphablending($im, true);
imagesavealpha($im, true);
imagecolorallocatealpha($im, 0, 0, 0, 127);
$font['color'] = imagecolorallocatealpha($im, 0, 0, 255, 25);
imagettftext($im, $font['size'], 0, 0, 15, $font['color'], $font['path'], $string); //TTF text
imagepng($im);
imagedestroy($im);
I'm using FF 1.0.6 btw , so no IE here
This post was edited on 09-09-2005 at 04:16 PM by Ezra.
|
|
09-09-2005 04:14 PM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
RE: PHP GD help
code: $im = imagecreatetruecolor(50, 50);
imagesavealpha($im,true);
imagealphablending($im, false);
$bg = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im,0,0,$bg);
$font['color'] = imagecolorallocatealpha($im, 0, 0, 255, 25);
imagettftext($im, 10, 0, 0, 15, $font['color'], $font['path'], 'test'); //TTF text
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
This works
This post was edited on 09-09-2005 at 05:06 PM by KeyStorm.
|
|
09-09-2005 05:06 PM |
|
|
Ezra
Veteran Member
Forgiveness is between them and God
Posts: 1960 Reputation: 31
37 / /
Joined: Mar 2003
|
O.P. RE: PHP GD help
Excellent
I read about that imagefill, but it gave me a 500 error when I tried to use it...
Anywaay, thanks a million
I'll use a simple palette with ugly text for IE users
and this one for better browser users
|
|
09-09-2005 05:30 PM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
RE: PHP GD help
Or just do what I did with my sig: a version for IE and one for standars-complying
(look at it in IE)
|
|
09-09-2005 05:33 PM |
|
|
Ezra
Veteran Member
Forgiveness is between them and God
Posts: 1960 Reputation: 31
37 / /
Joined: Mar 2003
|
O.P. RE: PHP GD help
I have it like this.
Alpha transparancy for good browsers and normal (ugly) transparancy for IE.
|
|
09-09-2005 06:03 PM |
|
|
Pages: (2):
« First
«
1
[ 2 ]
Last »
|
|