What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP GD help

Pages: (2): « First « 1 [ 2 ] Last »
PHP GD help
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
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-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
09-09-2005 02:46 PM
Profile PM Web Find Quote Report
KeyStorm
Elite Member
*****

Avatar
Inn-sewer-ants-pollie-sea

Posts: 2156
Reputation: 45
38 / Male / –
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 :S

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
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: PHP GD help
Hmm, but I keep having a black background if I use a TrueColor image...
[Image: 1-0.png]
             
09-09-2005 03:07 PM
Profile PM Web Find Quote Report
KeyStorm
Elite Member
*****

Avatar
Inn-sewer-ants-pollie-sea

Posts: 2156
Reputation: 45
38 / Male / –
Joined: Jan 2003
RE: PHP GD help
Oh, sorry
it's colorallocatealpha($img,$r,$g,$b,$alpha)
09-09-2005 03:36 PM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: PHP GD help
Still the black background :S

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.
[Image: 1-0.png]
             
09-09-2005 04:14 PM
Profile PM Web Find Quote Report
KeyStorm
Elite Member
*****

Avatar
Inn-sewer-ants-pollie-sea

Posts: 2156
Reputation: 45
38 / Male / –
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 :)
[Image: ezra.php]

This post was edited on 09-09-2005 at 05:06 PM by KeyStorm.
09-09-2005 05:06 PM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
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 :P
and this one for better browser users :)
[Image: 1-0.png]
             
09-09-2005 05:30 PM
Profile PM Web Find Quote Report
KeyStorm
Elite Member
*****

Avatar
Inn-sewer-ants-pollie-sea

Posts: 2156
Reputation: 45
38 / Male / –
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
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
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.

[Image: sig.php]
[Image: 1-0.png]
             
09-09-2005 06:03 PM
Profile PM Web Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On