|
Author: PraVeeN
I developed this tool with PHP and GD library. You can merge Watermark text to a
group of files at a time. This will be helpful for you to add text to your
photos which taken with Digital Camera.
<?php
/*
JPEG Image Watermarking tool - v1.0a
Author: Praveen -
NinethSense
Date : 01 Oct 2006
Copyright: NinethSense
Warning: You
can use this script for personal as well as commercial purpose.
But If
you are using this script EXACTLY AS IT IS... then you should use the
word
"NinethSense"
somewhere.
*/
?>
<?php
set_time_limit(3600);
if
(strlen($_REQUEST['txtFolder']) >
0)
$path=$_REQUEST['txtFolder'];
else
$path = "C:\\";
if (isset($_REQUEST['btnLoad']) || isset($_REQUEST['btnApply']))
{
$d = dir($_REQUEST['txtFolder']);
$files = "";
while
(false !== ($entry = $d->read())) {
if (stristr($entry,".jpg")
)
$files .= "<option value='$entry'>$entry</option>";
}
$d->close();
}
if (isset($_REQUEST['btnApply'])) {
for ($i=0;$i <
count($_REQUEST["cboFiles"]);$i++) {
$im=imagecreatefromjpeg("$path\\" .
$_REQUEST["cboFiles"][$i] );
imagestring($im,2,10,0,$_REQUEST['txtText'],
imagecolorallocate($im,200,200,200) );
imagejpeg ($im,
"output/".$_REQUEST["cboFiles"][$i] );
imagedestroy($im);
}
echo
"<b style='color:green'>Watermark Added Successfully to $i
file(s)</b><br><br><br>";
}
?>
<b>Image Watermark Tool v1.0a from NinethSense</b>
<form action="<?= $_SERVER['PHP_SELF'] ?>"
method="post">
<table width="500" border="1">
<tr>
<td width="110">Folder</td>
<td> <input
name="txtFolder" type="text" id="txtFolder" value="<?= stripcslashes($path)
?>" size="50" /></td>
</tr>
<tr>
<td
colspan="2" align="center"><input name="btnLoad" type="submit"
id="btnLoad" value="Load Images" /></td>
</tr>
<tr>
<td colspan="2">
<select name="cboFiles[]"
size="10" multiple="multiple" id="cboFiles">
<?= $files
?>
</select>
</td>
</tr>
</table>
<br />
<?php
if (count($files)
> 0) {
?>
<table width="500" border="1">
<tr>
<td width="110">Watermark Text </td>
<td width="300"><input name="txtText" type="text" id="txtText"
value="Sample Watermark Text" size="45" /></td>
</tr>
<tr>
<td colspan="2"
align="center"><input name="btnApply" type="submit" id="btnApply"
value="Apply Watermark" /></td>
</tr>
</table>
<?
}
?>
</form>
Download Code
|