Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Lionsanime Directory   High Bandwidth Dedicated Servers   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 03-26-2006, 07:35 PM   #1 (permalink)
Inactive
 
Join Date: 03-26-06
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

Rossy is liked by many
Question gd Imagecolortransparent function broken?

hi can someone explain how the Imagecolortransparent() function works exactly? i found this example from the php.net reference but its not making any sense:

PHP Code:
<?
$image 
imagecreatetruecolor(19236);
$trans_color imagecolorallocate($image25500);
$color imagecolorallocate($image255255255);
imagecolortransparent($image$trans_color);
imagettftext($image1001023$color"impact.ttf"" MENU ITEM");
imagegif($image"output.gif");
imagedestroy($image);
?>
Outputs:


the background and text become transparent but the transparent color is red not black or white? i dont get it. i've been asking people everywhere but no one seems to be able to give me an answer. if someone could just make the above code output white text on a transparent background and explain it that would be great
Rossy is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 03-26-2006, 09:27 PM   #2 (permalink)
Inactive
 
Join Date: 03-26-06
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

Rossy is liked by many
sorry my bad the black background becomes transparent but the transparent color is set to red? the white writing remains opaque which makes sense.
Rossy is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-26-2006, 11:16 PM   #3 (permalink)
Inactive
 
Join Date: 03-26-06
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

Rossy is liked by many
i've actually found out exactly wat the problem is... well atleast i think i have. this is the code i'm using. i'm trying to make the black background transparent.
PHP Code:
<?
$image 
imagecreatetruecolor(19236);
$trans_color imagecolorallocate($image000);
$color imagecolorallocate($image255255255);
imagefill($image00$trans_color);
imagettftext($image1001023$color"impact.ttf"" MENU ITEM");
imagecolortransparent($image$trans_color);
imagegif($image"output.gif");
?>
aight when i chose the transparent color in its truecolor form (so black [0,0,0]) its pointing to the truecolor index for black which is 0. however when i save it as a gif the palette changes and index 0 in the gif then becomes a different color (its like 20,14,20) or something. hence the transparent property is being passed onto index 0 in the gif and instead of the new black (0,0,0) index being transparent, this other color is. i'll show u an image to demonstrate that there is infact transparency, its just on the wrong color:



you might have to save the image and zoom in on it but theres 1 red pixel there which appeared when i placed the image on top of a red canvas. so yer the transparency is infact working its just pointing to the wrong index in the gif... well thats my theory anyway. does anyone know how to fix this?
Rossy is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help - I broke the showPane function! watley Coding Forum 4 11-29-2007 09:14 PM
Does wordpress have an email function? DarkNinja Blogging Forum 1 03-24-2006 09:07 AM
PHP Back Function /w Reload bytech Coding Forum 1 07-06-2005 07:30 AM
function SymError GoldDust Coding Forum 3 02-25-2004 07:19 AM
CSS Function Reference Leader of Men Coding Forum 4 02-03-2004 01:11 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 03:23 PM.
© Copyright 2008 V7 Inc