I've been trying to get this to work for several hours and I've had no luck. The basic thing I'm trying to do here is take an image, and then place a colored layer over it, to produce a 'colorized' effect. I tried to use the code from the phpbuilder article about advanced images to help me, but again, I've not been able to get it to work. What happens after my code runs is that, from what I can tell, the background image is being turned into flat black, and thus, the end result isnt correct at all.
Here is the code I've got, with some explainations:
//$row[1] is the filename of the image, example: 'upload/picture.jpg'
//$row[11] is the R value of RBG
//$row[12] is the B value of RBG
//$row[13] is the G value of RBG
$im = imagecreatefromjpeg($row[1]); //Get Image
$im_w = imagesx($im); //Find Image Width
$im_h = imagesy($im); //Find Image Height
$layover = imagecreate($im_w,$im_h); //Create Layover
$color = imagecolorallocate($layover,$row[11],$row[12],$row[13]); // Set desired color
$fill = imagefill($layover,5,5,$color); // Fill Layover with color
$merge = imagecopymerge($im,$layover,0,0,0,0,$im_w,$im_h,$row[10]); // Merge layers
imagedestroy($layover); // Destroy the layover
$row[1] = preg_replace("/upload/","output",$row[1]);
imagejpeg($im,"$row[1]",100); //Ready filename to be saved in a new directory
fwrite($HTML, "<img src=\"$row[1]\">"); // output html code to file
Any help would be GREATly appreciated, I'm getting so frustrated over this.
(btw, my server uses PHP 4.2.3 and GD 2.0.12)
Thank you!