Jump to content

PHP Image Building.


MrSheen

Recommended Posts

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 :)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.