Thanks this will help protect images.
SticKer
This is a discussion on php script for create a watermark image. within the Programming forums, part of the Web Designing & Development category; Hi I found this article when i stumbling. And i think this is informative for all of you friends. List ...
Hi
I found this article when i stumbling. And i think this is informative for all of you friends.
List of things needed:
1. your image in any format
2. watermark image--in gif format with transparent background
3. script below with name (i.e. watermark.php)
code
Name this script, i.e. watermark.php and call this script as following:<?php
// this script creates a watermarked image from an image file - can be a .jpg .gif or .png file
// where watermark.gif is a mostly transparent gif image with the watermark - goes in the same directory as this script
// where this script is named watermark.php
// call this script with an image tag
// <img src="watermark.php?path=imagepath"> where path is a relative path such as subdirectory/image.jpg
$imagesource = $_GET['path'];
$filetype = substr($imagesource,strlen($imagesource)-4,4);
$filetype = strtolower($filetype);
if($filetype == ".gif") $image = @imagecreatefromgif($imagesource);
if($filetype == ".jpg") $image = @imagecreatefromjpeg($imagesource);
if($filetype == ".png") $image = @imagecreatefrompng($imagesource);
if (!$image) die();
$watermark = @imagecreatefromgif('watermark.gif');
$imagewidth = imagesx($image);
$imageheight = imagesy($image);
$watermarkwidth = imagesx($watermark);
$watermarkheight = imagesy($watermark);
$startwidth = (($imagewidth - $watermarkwidth)/2);
$startheight = (($imageheight - $watermarkheight)/2);
imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);
imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);
?>
HTML
the only thing you need to chage is "image_name.filetype" and of course you can have the relative path such as:<img src="watermark.php?path=image_name.filetype">
HTML
<img src="folder/watermark.php?path=folder/imagename">
The caution here is the script watermark.php and watermark.gif should be in the same location. watermark.gif should have transparent background.
As you can read it from the site, the location where the watermark.gif appears can be modified by adjusting this line of the code:
CODE
To have it appear on the bottom right corner, try this:$startwidth = (($imagewidth - $watermarkwidth)/2);
$startheight = (($imageheight - $watermarkheight)/2);
CODE
thanks$startwidth = (($imagewidth - $watermarkwidth) );
$startheight = (($imageheight - $watermarkheight) );
Thanks this will help protect images.
SticKer
Buy / Sell / Trade Products and Services at our Webmaster Marketplace
61 Ways To Drive Targeted Traffic To Your Website
thanks a lot.
it is very useful to protect image.
thanks again.
[SIZE=3][FONT=Franklin Gothic Medium]Well thanks a lot for that piece ov code,i too was searchin for it
[/FONT][/SIZE]
[SIZE=3][FONT=Georgia]better Adsense CTR[/FONT][/SIZE]
I have find it here also. check it.
http://www.phpjabbers.com/put-waterm...php-php20.html
It is a right code for protect image and the links are very useful,thanks a lot.
Bookmarks