View Single Post
Old 08-10-2010, 02:29 PM   #1 (permalink)
danceRobot
The Wanderer
 
Join Date: Jul 2010
Posts: 6
Thanks: 1
danceRobot is on a distinguished road
Default 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 is offline  
Reply With Quote