Image Layering + Coloring

I’m trying to make a webpage where people can choose colors of certain image layers.

I have two pages, shana.php (which is what is used to choose colors, it works just fine) and shana_image.php which is where I’m having problems.
I’m starting off just changing the color of one layer. The url being sent in is:
http://ekosmasks.com/shana_img.php?base=#FFFFFF&eyes=#52F3FF&nose=#FFFFFF

[php]<?php

//get values from url
$base = $_GET[‘base’];
$eyes = $_GET[‘eyes’];
$nose = $_GET[‘nose’];

$layers = array();

//base
$layers[] = imagecreatefrompng(“include/pics/mask/base.png”);

//marking
//$layers[] = imagecreatefrompng(“include/pics/mask/m_leaf.png”);

//eyes w/color
$r[] = hexdec(substr($eyes, 0, 2));
$g[] = hexdec(substr($eyes, 2, 2));
$b[] = hexdec(substr($eyes, 4, 2));
$layers[] = imagecreatefrompng(“include/pics/mask/eyes.png”);

//nose
$layers[] = imagecreatefrompng(“include/pics/mask/nose.png”);

//lineart
$layers[] = imagecreatefrompng(“include/pics/mask/lines.png”);

//layering stuff
$image = imagecreatetruecolor(480, 400);
for ($i = 0; $i < count($layers); $i++) {
$co=imagecolorallocate($layers[$i], $r[$i], $g[$i], $b[$i]);
imagecopy($image, $co, 0, 0, 0, 0, 480, 400); //ERROR: supplied argument is not a valid Image resource
}
imagealphablending($image, false);
imagesavealpha($image, true);
header(‘Content-type: image/png’);
imagepng($image);

imagedestroy($image);

?>[/php]

Any help with this would be wonderful!!!

Sponsor our Newsletter | Privacy Policy | Terms of Service