I want to add watermark on multiple images and display them on browser. Here is my piece of code:
<?php
include('admin/connect.php');
$q = mysql_query("select * from ring");
while($row=mysql_fetch_array($q)){
$img = 'admin/'.$row['Image'];
$stamp = imagecreatefrompng('admin/image/watermark.png');
$im = imagecreatefromjpeg($img);
$marge_right= 20;
$marge_bottom = 50;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
}
?>
I have used header('Content-type: image/png');
in my code due to which I am not able to display all the images.
Here I am fetching images from database and then adding watermark on it but it will be better if anyone of you can help me to add watermark first and then save it in database.
Thanks in advance.