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
Water Mark your images with php
Old 09-22-2005, 07:57 PM Water Mark your images with php
Skilled Talker

Posts: 60
Trades: 0
I wrote a small article that and I though it will be nice to share with you


Do you have an image that you want to keep a copyright on? Putting you logo or a URL of your website on each and every image is a quite a long and tedious process so here is a solution in PHP that will help you make things easier and neater.


Using this script one can specify two images: the image to be watermarked and the watermark itself. If you have several images do not waste time putting your watermark on each and every image. Just use this script and all your images are watermarked

PHP Code:
<?php  

header
('content-type: image/jpeg');  //tells the webserver that the output will be an image 


$_image "snippetcollection.jpg"'; $watermark = 'watermark.png';
$watermark = imagecreatefrompng($watermark);  //gets the watermark 
//gets the dimensions of the watermark 
$watermark_width = imagesx($watermark);  
$watermark_height = imagesy($watermark);  

$image = imagecreatetruecolor($watermark_width, $watermark_height); 
 //gets the image to put the watermark on and related information about it 
$image = imagecreatefromjpeg($_image);  
$size = getimagesize($_image);  
$dest_x = $size[0] - $watermark_width - 5;  
$dest_y = $size[1] - $watermark_height - 5;  

imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);  
imagejpeg($image);  
imagedestroy($image);  
imagedestroy($watermark);  

?>
If you would like more interesting snippets and examples in PHP visit Snippet Collection. There you can find a large number of snippets in various languages such as PHP, Javascript and other languages.

Note this script is inspired by a sitepoint article.

Last edited by bambolin; 09-23-2005 at 05:14 AM..
bambolin is offline
Reply With Quote
View Public Profile Visit bambolin's homepage!
 
 
Register now for full access!
Old 09-23-2005, 01:39 PM
Extreme Talker

Posts: 169
Trades: 0
Hi bambolin,
If you can provide php script, with text as watermark centered in the middle of the image. The watermark is bevel and embossed filled with the background image. If you have any such script, it would be a great help.
__________________

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

TOP 10 WEB HOSTS COMPARED

BEST RESELLER HOSTING
john551 is offline
Reply With Quote
View Public Profile
 
Old 09-23-2005, 09:19 PM
Skilled Talker

Posts: 60
Trades: 0
Maybe you could find something at the resource in my signature! :-)
bambolin is offline
Reply With Quote
View Public Profile Visit bambolin's homepage!
 
Reply     « Reply to Water Mark your images with php
 

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.45391 seconds with 12 queries