MrSheen Posted June 15, 2007 Share Posted June 15, 2007 Hey guys, im looking into building a website which has avatar creation programs on it. Now ive seen some websites, and you can buy like clothes to put on the character. Then when you view the character, it builds up your avatars to show what clothes you are wearing. It looks like char.png?t=00 How is building up a image in php possible? Say i want to have: 1.png, 2.png, 3.png all layered up on top of each other. Is this possible? Thanks Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted June 15, 2007 Share Posted June 15, 2007 I suggest you look into the uses of the GD library in php. Hopefully this tutorial might get you started: http://www.phpfreaks.com/tutorials/105/0.php Quote Link to comment Share on other sites More sharing options...
MrSheen Posted June 15, 2007 Author Share Posted June 15, 2007 I suggest you look into the uses of the GD library in php. Hopefully this tutorial might get you started: http://www.phpfreaks.com/tutorials/105/0.php Alright, thanks shall read through that now Quote Link to comment Share on other sites More sharing options...
MrSheen Posted June 15, 2007 Author Share Posted June 15, 2007 Okay, using that. How would i layer a image up? Also, how would a certain colour be transparent? Quote Link to comment Share on other sites More sharing options...
MrSheen Posted June 16, 2007 Author Share Posted June 16, 2007 Guys, anyone help? Quote Link to comment Share on other sites More sharing options...
Rojay Posted June 16, 2007 Share Posted June 16, 2007 http://www.php.net/manual/en/ref.image.php Quote Link to comment Share on other sites More sharing options...
MrSheen Posted June 16, 2007 Author Share Posted June 16, 2007 See, i really need someone to just like make an example code to show me how to layer the images. Quote Link to comment Share on other sites More sharing options...
Rojay Posted June 16, 2007 Share Posted June 16, 2007 okay let's say you have three images that you want to be placed on each other first you create an image resource $im1 = imagecreatefromjpeg("img1.jpg"); $im2 = imagecreatefromjpeg("img2.jpg"); $im3 = imagecreatefromjpeg("img3.jpg"); now you want to place $im2 on $im1 where $x,$y is the position which you want to place $im2 knowing that the origin is at the top left corner and $x1,$y1 is the point where you want to start the copying probably it will jsut be 0,0 to copy the whole image imagecopyresampled ($im1, $im2, $x, $y, $x1, $y1, imagesx($im1), imagesy($im1), imagesx($im2), imagesx($im2) ) and repeat with $im3 as for transperancy you can use where $im1 is the image resource and $color is an RBG color created using imagecolorallocate($im1,255,255,255) imagecolortransparent($im1,$color) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.