Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Image Watermarking...
Old 11-04-2008, 05:47 AM Image Watermarking...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
Hi,

I want to re-water mark my images...I liked doing that in windows, but now prefer to try it using a php script to see if that works to my liking...Does someone have a descent dynamic watermarking php script that will work on any type of images? Gif, Jpg, or Png are the types I will be working with...Please provide one of each style; One that will place an image watermark and one that will place a text watermark on each of the images.

Thank you
__________________
Made2Own

Please login or register to view this content. Registration is FREE
Brian07002 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-04-2008, 06:44 AM Re: Image Watermarking...
Average Talker

Posts: 25
Trades: 0
Hi

I found this script when i stumbling on net.
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

Quote:
<?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);
?>
thanks
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
masteryooshi is offline
Reply With Quote
View Public Profile
 
Old 11-04-2008, 06:55 AM Re: Image Watermarking...
Brian07002's Avatar
Defies a Status

Posts: 2,162
Name: ...
Location: ...
Trades: 0
I don't want to call it from an image tag, I want to just drop it in the folder and have it do the 'dirty work' for me...Apply watermark to all images, not just one, or having to specify an <img tag for each watermarked image

Thanks for the post though
__________________
Made2Own

Please login or register to view this content. Registration is FREE

Last edited by Brian07002; 11-04-2008 at 07:48 AM..
Brian07002 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Image Watermarking...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17802 seconds with 12 queries