TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Create a new transparent image? (http://www.talkphp.com/absolute-beginners/5543-create-new-transparent-image.html)

danceRobot 08-10-2010 02:29 PM

Create a new transparent image?
 
Hey there!

I have a small problem here... Im trying to create some images that consist of multiple layers, and I want the base image to be complete transparent before I place any other layers on top of it...

Placing the layers onto each other works, but the base image is just "black" due to imagecreatetruecolor(). How can I make the background completely transparent beffore I place the other layers on top of it???

Here is my code
PHP Code:

            $ptlMask imagecreatefrompng(BB_PATH."default_mask.png");
            
$white imagecolorallocate($ptlMask255255255);
            
$font BB_PATH."arial.ttf";
            
# GET PSN ID STATS
            
if($this->ptlProfile["result"]==true){
                
# CREATE BLANK IMAGE
                
$background imagecreatetruecolor(550,125);
                
# SET BACKGROUND
                # !!!!!!!!!!!!!!!!!!!!!!! SET IF FOR BACKGROUND !!!!!!!!!!!!!!!!!!!!!!!!!
                
if($defaultBackground>0){
                    
$backgroundImage imagecreatefromjpeg(BB_PATH."default_background_".$defaultBackground.".jpg");
                    
$image imagecopyresampled($background,$backgroundImage,2,2,0,0,548,123,548,123);
                    
# CREATE TEMP IMAGE
                    #imagepng($image,BB_PATH."TEMP".$userId.".png",100);
                
}else{
                    
# CUSTOM PIC UPLOAD    
                
}
                
# PLACE MASK ON TOP
                
$image imagecopyresampled($background,$ptlMask,0,0,0,0,550,125,550,125);
                
# INSERT STATS
                
                # XP BAR
                
                # SAVE IMAGE
                
$checkImageSave imagepng($background,BB_PATH.$userId.".png",9);
                
#$text2Image = imagettftext($background,12,0,50,50,$white,$font,"THIS IS A TEST");
                
return $status

thanks for any help on this small problem :)

danceRobot 08-19-2010 05:57 PM

bump bump :)


All times are GMT. The time now is 01:40 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0