Jump to content

[SOLVED] watermarking


dare87

Recommended Posts

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>

 

1225162001.jpg

Link to comment
https://forums.phpfreaks.com/topic/130375-solved-watermarking/
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.