dare87 Posted October 28, 2008 Share Posted October 28, 2008 I am trying to put a watermark on the images but am having a bit of a problem. I don't know if it's because of the .png that I am using or if it's the code. Here is what I have.... WATERMAKR.PHP PAGE <?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('images/watermark.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg('photogallery/images/'.$_GET['file']); $size = getimagesize('photogallery/images/'.$_GET['file']); $dest_x = $size[0] - $watermark_width - 100; $dest_y = $size[1] - $watermark_height - 100; imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($watermark); ?> PICS-VIEW.PHP PAGE <?php // Include the PHP script that contains the session information. include('includes/session.php'); $picture = $_GET['picture']; $cap = $_GET['cap']; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php echo "$cap"; ?> | Site Name</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" src="includes/include.js"></script> </head> <body> <img src="watermark.php?file=<?php echo "$picture"; ?>" alt="<?php echo "$cap"; ?> "></img> </body> </html> Link to comment https://forums.phpfreaks.com/topic/130375-solved-watermarking/ Share on other sites More sharing options...
GKWelding Posted October 28, 2008 Share Posted October 28, 2008 You just havn't set the transparency on the PNG correctly. Unfortunately I'm not gfx expert so I can't really help you with this, but I can confirm that it's a problem with your PNG and not your code. Link to comment https://forums.phpfreaks.com/topic/130375-solved-watermarking/#findComment-676526 Share on other sites More sharing options...
dare87 Posted October 28, 2008 Author Share Posted October 28, 2008 thanks, does anyone know what is wrong with the png? Or know the correct settings? Link to comment https://forums.phpfreaks.com/topic/130375-solved-watermarking/#findComment-676656 Share on other sites More sharing options...
damianjames Posted October 28, 2008 Share Posted October 28, 2008 Is the PNG 24bit or 8? Link to comment https://forums.phpfreaks.com/topic/130375-solved-watermarking/#findComment-676688 Share on other sites More sharing options...
dare87 Posted October 28, 2008 Author Share Posted October 28, 2008 Is the PNG 24bit or 8? That was the problem. THANKS! I was using 24 and it needed to be 8. Link to comment https://forums.phpfreaks.com/topic/130375-solved-watermarking/#findComment-676693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.