TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-10-2010, 02:29 PM   #1 (permalink)
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
Old 08-19-2010, 05:57 PM   #2 (permalink)
The Wanderer
 
Join Date: Jul 2010
Posts: 6
Thanks: 1
danceRobot is on a distinguished road
Default

bump bump :)
danceRobot is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
How to create a gallery class Tanax Advanced PHP Programming 25 02-19-2013 04:25 AM
Image Reflections in PHP Rendair Advanced PHP Programming 17 11-30-2011 08:41 AM
Create your own advanced WYSIWYG editor almsamim Javascript, AJAX, E4X 8 10-23-2008 06:41 PM
Dynamicly place text on a background image ReSpawN Advanced PHP Programming 2 04-26-2008 09:37 PM
The Big GD Guide - Part 2 Rendair Advanced PHP Programming 3 03-07-2008 12:14 AM


All times are GMT. The time now is 03:43 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design