Jump to content

Help using GD/PHP


xxhopeful

Recommended Posts

I am currently working on creating a script that will allow people to pick a certain hex code, and an image will appear that is the color they selected. I believe you need to use some GD for this, I may be wrong but thats why I'm here! Heres an example of my script:

 

$base = @imagecreate(397, 500); 
$background_color = imagecolorallocate($base, 250, 255, 255); 

$body = imagecreatefromgif('images/base.gif');
imagecolortransparent($body); 
imagecopymerge ($base, $body, '0', '0', '0', '0', '397', '500', '100'); 
imagedestroy($body); 

$part1 = imagecreatefromgif('images/partone.gif');
imagecolortransparent($part1); 
imagecopymerge ($base, $part1, '0', '0', '0', '0', '397', '500', '100'); 
imagedestroy($part1); 

imagegif($base,'images/test.gif');
imagedestroy($base); 

 

This all works fine, I just don't know how to code it so the $body image would be able to turn black or gray and then the $part1 image could turn green or purple (just examples). Any suggestions? I tried looking through tutorials but nothing helped. Thanks!

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.