hi
i was wondering if anyone can tell me how to watermark all the images in a folder in php?i have this code here but it will only do the name of the image you put in thanks...
<?
include ("watermark.php");
$iw = new imageWaterMarker();
$iw->image_location = 'test.jpg'; <<<<ANYWAY TO CHANGE THIS TO ALL IMAGES IN FOLDER?
$iw->image_type = 'jpeg';
$iw->size = 1; //This could be any value from 1 to 5
$iw->copyright_text = '(C) 2004 : here';
$iw->markImage();
?>
<?
class imageWaterMarker
{
var $image_location;
var $copyright_text;
var $image_type;
var $size =1;
function markImage()
{
$img = GetImageSize($this->image_location);
$width = $img[0];
$height = $img[1];
switch ($this->image_type)
{
case 'jpg':
case 'jpeg':
//Here is JPG Loader
$im2 = imagecreatefromjpeg($this->image_location);
//End JPG loader
//Now JPG Text Color Change Tricks
$im = imagecreate($width,$height);
imagecopy($im,$im2,0,0,0,0,$width,$height);
//End Trick
break;
case 'png':
$im = imagecreatefrompng($this->image_location);
break;
}
$black = imagecolorallocate($im,0,32,234);
//$black = imagecolorallocate($im,12,132,34);
imagestring($im,$this->size,0,$height-30,$this->copyright_text,$black);
header ("Content: image/png");
imagepng($im);
}
}
?>