Jump to content

water mark trouble


corillo181

Recommended Posts

i took this code of a site, becuase i'm a rush to create a water mark,

but as simple as it looks when the images is save, it saves

as resource id#

<?php  
$watermark = imagecreatefrompng('logo2.png');

$watermark_width = imagesx($watermark);  
$watermark_height = imagesy($watermark);

$image = imagecreatetruecolor($watermark_width, $watermark_height);  
$image = imagecreatefromjpeg('eaa02aa217e7c72264582687e25183cb.jpg');  
$size = getimagesize('eaa02aa217e7c72264582687e25183cb.jpg');  

$dest_x = $size[0] - $watermark_width - 5;  
$dest_y = $size[1] - $watermark_height - 5;

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);  
imagejpeg($image,'new_'.$image,100);  
//imagedestroy($image);  
//imagedestroy($watermark);

?>

Link to comment
https://forums.phpfreaks.com/topic/92764-water-mark-trouble/
Share on other sites

alright i changed it a name but now the png that is been applied to the image does no contain it's transparency it turns white.

<?php  
$watermark = imagecreatefrompng('logofotos.png');

$watermark_width = imagesx($watermark);  
$watermark_height = imagesy($watermark);

$image = imagecreatetruecolor($watermark_width, $watermark_height);  
$image = imagecreatefromjpeg('e47ade7dacd19dce6251270cd5f5e83c.jpg');  
$size = getimagesize('e47ade7dacd19dce6251270cd5f5e83c.jpg');  

$dest_x = $size[0] - $watermark_width - 5;  
$dest_y = $size[1] - $watermark_height - 5;

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);  
imagejpeg($image,'new_image.jpg',100);  
//imagedestroy($image);  
//imagedestroy($watermark);

?>

Link to comment
https://forums.phpfreaks.com/topic/92764-water-mark-trouble/#findComment-475322
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.