Creating a transparent image

From: Date: Thu, 29 Nov 2001 15:11:11 +0000
Subject: Creating a transparent image
Groups: php.windows 
Request: Send a blank email to php-windows+get-10655@lists.php.net to get a copy of this message
What I would like to be able to do is to draw one image transparently over another. This is my function so far: function create_image() { global $im1; $im1 = @ImageCreateFromJPEG("d:\\projects\\graphics\\image1.jpg"); if(!$im1){ return false; exit; } $im2 = @ImageCreateFromJPEG("d:\\projects\\graphics\\image2.jpg"); if(!$im2){ return false; exit; } /* $color = ImageColorAt($im2, 0, 0); $color = ImageColorsForIndex($im2, $color); $color = ImageColorAllocate($im2, $color[0], $color[1], $color[2]); $result = ImageColorTransparent($im2, $color);*/ $result = ImageCopy($im1, $im2, 10, 10, 0, 0, @ImageSX($im2) - 1, @ImageSY($im2) - 1); if(!$result){ return false; exit; } // ImageColorDeAllocate($im2, $color); return true; } As long as I keep the lines that are commented out, it works fine (but no transparency). As soon as I uncomment the ImageColorAt function, I get an error. Any suggestions on where to proceed from here would be greatly appreciated. Also, if someone has a better suggestion as to how to accomplish what I am trying to, I'm all for that as well. Eric _______________________________________________________

« previous php.windows (#10655) next »