watermark, please help me to add watermark on this programming. please urgent

Started on the old forum in December 2012 · view the original in the archive · old links redirect here

#add-watermark #watermark

4 replies · 6,073 views · started 13 years ago · 1 min read

3 participants
kevk3v Senior · 332 posts #2
<?php
$font_path = "arial.ttf"; // path to font file, download one
$font_size = 30; /// font size
$water_mark_text_2 = "My Watermark Text"; // watermark text

function watermark_image($oldimage_name, $new_image_name)
{
global $font_path, $font_size, $water_mark_text_2;
list($owidth,$oheight) = getimagesize($oldimage_name);
$width = $height = 300; 
$image = imagecreatetruecolor($width, $height);
$image_src = imagecreatefromjpeg($oldimage_name);
imagecopyresampled($image, $image_src, 0, 0, 0, 0, $width, $height, $owidth, $oheight);
$blue = imagecolorallocate($image, 79, 166, 185);
imagettftext($image, $font_size, 0, 68, 190, $blue, $font_path, $water_mark_text_2);
imagejpeg($image, $new_image_name, 100);
imagedestroy($image);
unlink($oldimage_name);
return true;
}
?>

to use

<?php
watermark_image('Path to image to watermark', 'Path/Name to save the new image as');
?>

Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

manavworld Developer · 118 posts #3

kevk3v wrote:

<?php
$font_path = "arial.ttf"; // path to font file, download one
$font_size = 30; /// font size
$water_mark_text_2 = "My Watermark Text"; // watermark text

function watermark_image($oldimage_name, $new_image_name)
{
global $font_path, $font_size, $water_mark_text_2;
list($owidth,$oheight) = getimagesize($oldimage_name);
$width = $height = 300; 
$image = imagecreatetruecolor($width, $height);
$image_src = imagecreatefromjpeg($oldimage_name);
imagecopyresampled($image, $image_src, 0, 0, 0, 0, $width, $height, $owidth, $oheight);
$blue = imagecolorallocate($image, 79, 166, 185);
imagettftext($image, $font_size, 0, 68, 190, $blue, $font_path, $water_mark_text_2);
imagejpeg($image, $new_image_name, 100);
imagedestroy($image);
unlink($oldimage_name);
return true;
}
?>

to use

<?php
watermark_image('Path to image to watermark', 'Path/Name to save the new image as');
?>

i has post this uploader file. can you please solve this issue with image and thumb, i mean i want to have watermark on main image and thumbs as well.

Attachments: upload.txt
Dibyendu85 Newbie · 9 posts #5

At first download arial.ttf file n upload where ur php file lies.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close