Re: [PHP] watermark png on jpg

2006-01-03 Thread tedd

I have png image with transparent background, and 1 jpg file.
I use imageCopyMerge to paste the png image on the jpg image.

the result image contain no transparent background mean the png file 
have white background when its suppose to be transparent


what is the simple and best way to make this work.

tanks in advance. :)


Libit:

I was working on the same thing. The following is a solution -- but, 
simple and best are relative.


This was taken from PHP Graphics Handbook by Kent et al.

?
$original=imagecreatefromjpeg(apollo.jpg);
$watermark=imagecreatefrompng(xssportstransparent.png);

$osx=imagesx($original);
$osy=imagesy($original);
$wsx=imagesx($watermark);
$wsy=imagesy($watermark);

imagecopy($original, $watermark, ($osx-$wsx)/2, ($osy-$wsy)/2, 0, 0, 
$wsx, $wsy);


imagepng($original, apollo_trans.png);

?
html
body
table
trtd align=centerOrignal Image/tdtd 
align=centerWatermark/tdtd align=centerOrignal Image with 
Watermark/td/tr
trtdimg src=apollo.jpg/tdtdimg 
src=xssportstransparent.png/tdtdimg 
src=apollo_trans.png/td/tr

/table
/body
/html

Demo at:

http://xn--ovg.com/watermark

HTH's

tedd

--

http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] watermark png on jpg

2006-01-03 Thread Libit

tedd wrote:

I have png image with transparent background, and 1 jpg file.
I use imageCopyMerge to paste the png image on the jpg image.

the result image contain no transparent background mean the png file 
have white background when its suppose to be transparent


what is the simple and best way to make this work.

tanks in advance. :)


Libit:

I was working on the same thing. The following is a solution -- but, 
simple and best are relative.


This was taken from PHP Graphics Handbook by Kent et al.

?
$original=imagecreatefromjpeg(apollo.jpg);
$watermark=imagecreatefrompng(xssportstransparent.png);

$osx=imagesx($original);
$osy=imagesy($original);
$wsx=imagesx($watermark);
$wsy=imagesy($watermark);

imagecopy($original, $watermark, ($osx-$wsx)/2, ($osy-$wsy)/2, 0, 0, 
$wsx, $wsy);


imagepng($original, apollo_trans.png);

?
html
body
table
trtd align=centerOrignal Image/tdtd 
align=centerWatermark/tdtd align=centerOrignal Image with 
Watermark/td/tr
trtdimg src=apollo.jpg/tdtdimg 
src=xssportstransparent.png/tdtdimg 
src=apollo_trans.png/td/tr

/table
/body
/html

Demo at:

http://xn--ovg.com/watermark

HTH's

tedd




thank you tedd , my original code is pretty the same.
and I solved the problem using function called
imagecopyresampled()
the function keep the transparent background of the png file.

from some sources on the net I read  the its may be related to some miss 
support in png 24bit. but I didn't get too much to it.


thanks again for taking the time to write and help me.

I think this is on solution for this problem I found it the easy one.

ah , one more thing, in my code I save the result image as an Jpg file.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] watermark png on jpg

2006-01-02 Thread Libit

I have png image with transparent background, and 1 jpg file.
I use imageCopyMerge to paste the png image on the jpg image.

the result image contain no transparent background mean the png file 
have white background when its suppose to be transparent


what is the simple and best way to make this work.

tanks in advance. :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php