| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Watermark Your Image With Simple Php Script
Started by BuffaloHelp, Apr 24 2006 02:46 AM
42 replies to this topic
#27
Posted 01 November 2007 - 04:36 AM
Trap FeedBacker, on Oct 11 2007, 09:00 PM, said:
How to create watermark on pdf files in php? can you provide me php script please.............
thank you!
-siva rama krishna
thank you!
-siva rama krishna
I use a pdf creation software named cutepdf to enhance my pdf output. Actually, i have the cutepdf paid version, might be the paid version which has all the nice features, but I think the basic, free version can 'stamp' pdf pages, too.
http://www.cutepdf.com/
#29
Posted 04 December 2007 - 11:50 AM
Hello people thank you for this script and as I made one that works for me for watermarking multiple picture on upload .
<?php
$watermarkPath = '/root_path_to_png_watermark/'.$watermark_name.'.png';
$target = '/root_path_to_where_upload_after_watermarking/'.$uploaded_picture_name;
$quality = "100";
$imagesource = '/root_path_to_where_upload_after_watermarking/'.$uploaded_picture_name;
$filetype = substr($imagesource,strlen($imagesource)-4,4);
$filetype = strtolower($filetype);
$watermarkType = substr($watermarkPath,strlen($watermarkPath)-4,4);
$watermarkType = strtolower($watermarkType);
if($filetype == ".gif")
$image = @imagecreatefromgif($imagesource);
else
if($filetype == ".jpg" || $filetype == "jpeg")
$image = @imagecreatefromjpeg($imagesource);
else
if($filetype == ".png")
$image = @imagecreatefrompng($imagesource);
else
die("a murit nu am scos imaginea");
if(!$image)
die("a murit nu avem imagine");
if($watermarkType == ".gif")
$watermark = @imagecreatefromgif($watermarkPath);
else
if($watermarkType == ".png")
$watermark = @imagecreatefrompng($watermarkPath);
else
die("a murit $watermark nu e");
if(!$watermark)
die("a murit lipsa watermark");
$imagewidth = imagesx($image);
$imageheight = imagesy($image);
$watermarkwidth = imagesx($watermark);
$watermarkheight = imagesy($watermark);
$startwidth = (($imagewidth - $watermarkwidth)/to);
$startheight = (($imageheight - $watermarkheight)/to);
imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);
imagejpeg($image,$target,$quality);
imagedestroy($image);
imagedestroy($watermark);
?>
Hope this works for you.
-Costin Iordache
<?php
$watermarkPath = '/root_path_to_png_watermark/'.$watermark_name.'.png';
$target = '/root_path_to_where_upload_after_watermarking/'.$uploaded_picture_name;
$quality = "100";
$imagesource = '/root_path_to_where_upload_after_watermarking/'.$uploaded_picture_name;
$filetype = substr($imagesource,strlen($imagesource)-4,4);
$filetype = strtolower($filetype);
$watermarkType = substr($watermarkPath,strlen($watermarkPath)-4,4);
$watermarkType = strtolower($watermarkType);
if($filetype == ".gif")
$image = @imagecreatefromgif($imagesource);
else
if($filetype == ".jpg" || $filetype == "jpeg")
$image = @imagecreatefromjpeg($imagesource);
else
if($filetype == ".png")
$image = @imagecreatefrompng($imagesource);
else
die("a murit nu am scos imaginea");
if(!$image)
die("a murit nu avem imagine");
if($watermarkType == ".gif")
$watermark = @imagecreatefromgif($watermarkPath);
else
if($watermarkType == ".png")
$watermark = @imagecreatefrompng($watermarkPath);
else
die("a murit $watermark nu e");
if(!$watermark)
die("a murit lipsa watermark");
$imagewidth = imagesx($image);
$imageheight = imagesy($image);
$watermarkwidth = imagesx($watermark);
$watermarkheight = imagesy($watermark);
$startwidth = (($imagewidth - $watermarkwidth)/to);
$startheight = (($imageheight - $watermarkheight)/to);
imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);
imagejpeg($image,$target,$quality);
imagedestroy($image);
imagedestroy($watermark);
?>
Hope this works for you.
-Costin Iordache
#30
Posted 04 January 2008 - 07:40 PM
Thanks for posting the code, I am using it on most of my site.
I was wondering if you guys might have an idea on how to pull watermarking off on a href tag. (click a thumbnail to display the large image)
Here is what I tried
Clicking the link yields the raw gd output similar to this
Thanks,
Sean
I was wondering if you guys might have an idea on how to pull watermarking off on a href tag. (click a thumbnail to display the large image)
Here is what I tried
<a href="watermark.php?path=images/image1.jpg"><img src="images/image1_thumbnail.jpg" />
Clicking the link yields the raw gd output similar to this
Quote
�JFIF�������>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality �C� $.' ",#(7),01444'9=82<.342�C 2!!22222222222222222222222222222222222222222222222222�y "������������ ����}�!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������� ���w�!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���?�ReI0#L #w̐)Du83J�2mC4hL\/qڬ{hF!
Thanks,
Sean
#32
Posted 04 January 2008 - 08:06 PM
#34
Posted 31 May 2008 - 08:44 PM
Overwrite image
Watermark Your Image With Simple Php Script
Hi guys, I'm new to PHP. I have this problem on overwriting the image after watermarking the image from the user directory.
I'm not sure is it this part that will overwrite the image or to other directory (imagejpeg($image,$target,$quality);).
But I tried this, it doesn't work.
Lot of help...
Cyrus
Watermark Your Image With Simple Php Script
Hi guys, I'm new to PHP. I have this problem on overwriting the image after watermarking the image from the user directory.
I'm not sure is it this part that will overwrite the image or to other directory (imagejpeg($image,$target,$quality);).
But I tried this, it doesn't work.
Lot of help...
Cyrus
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users















