helppy Posted November 16, 2006 Share Posted November 16, 2006 I am faced with problems using php gd as i am doing some image manuplication.I am actually trying to display an image (e.g 800*600) as the main display then having a photo (e.g 100*70) on top on it, with a starting co-ordinate points of (0,0).I am able to display the photo on top of it but am unable to alpha the photo so that the display area behind the photo is visible too.does anyone knows how to solve my problem?Thanks. Link to comment https://forums.phpfreaks.com/topic/27433-php-gd-image-alphaing/ Share on other sites More sharing options...
printf Posted November 16, 2006 Share Posted November 16, 2006 Sure it can be done, could you show me your script so I can tell you what you need to change... Link to comment https://forums.phpfreaks.com/topic/27433-php-gd-image-alphaing/#findComment-125504 Share on other sites More sharing options...
helppy Posted November 16, 2006 Author Share Posted November 16, 2006 <?php$im_a = @imagecreatefrompng("images/Water lilies.png");//$im_b = @imagecreatefrompng("images/SunsetEDIT.png");$im_b_x = 10;$im_b_y = 10;$im_b = imagecolorallocatealpha($im_a, 0, 0, 0, 50);imagefilledrectangle($im_a, 0, 0, 100, 100 , $im_b);//$im_c = imagecolorallocatealpha($im_a, 255, 0, 0, 50);//imagefilledrectangle($im_a, 0, 0, 200, 200 , $im_c);header("Content-type: image/png");imagepng($im_a);?> --------------------------------------------------------------------------------------------<?php $adImage = ImageCreateFromJPEG('images/Water lilies.jpg'); ImageAlphaBlending($adImage, true); $photoImage = ImageCreateFromJPEG('images/top.jpg'); //$photoImage = imagecolorallocatealpha($adImage, 0, 255, 0, 50);$logoW = ImageSX($photoImage); $logoH = ImageSY($photoImage); ImageCopy($adImage, $photoImage, 0, 0, 0, 0, $logoW, $logoH); //output to browser ImageJPEG($adImage);ImageDestroy($adImage); ImageDestroy($photoImage); ?>-------------------------------------------------------------------------------------------- Both have different output:First one, it has alpha but its a drawn rectangle.Second one, has photo overlap but not alpha.The output i hope to get is the combining of both - photo that is being alpha.thanks!!! Link to comment https://forums.phpfreaks.com/topic/27433-php-gd-image-alphaing/#findComment-125635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.