I will get to the point. I have installed Watermark using htaccess. Everything is working but I have no idea on how to make script NOT to place watermark on images smaller than 200×200. Also watermark is displaying a grayish line on the bottom where watermark.png sopose to be. How do I remove that line?
I oppologise for showing no effort. i did research for 4 hours and modify it so bad that my pictures was ruined. I found the line to add to php to not place watermark on small images, but do not know where to place it.
Here is the .php that places the watermark on image. Please help Is it is way to complicated for me.
<?php
$basedir="/uploads/";
$watermarkimage="tbwm.png";
$file=basename($_GET['i' ]);
$image = $basedir."/".$file;
$watermark = $basedir."/".$watermarkimage;
$im = imagecreatefrompng($watermark);
$ext = substr($image, -3);
if (strtolower($ext) == "gif") {
if (!$im2 = imagecreatefromgif($image)) {
echo "Error opening $image!"; exit;
}
} else if(strtolower($ext) == "jpg") {
if (!$im2 = imagecreatefromjpeg($image)) {
echo "Error opening $image!"; exit;
}
} else if(strtolower($ext) == "png") {
if (!$im2 = imagecreatefrompng($image)) {
echo "Error opening $image!"; exit;
}
} else {
die;
}
imagefilledrectangle($im2, 0 , (imagesy($im2))-(imagesy($im)) , imagesx($im2) , imagesy($im2) , imagecolorallocatealpha($im2, 0, 0, 0, 100) );
imagecopy($im2, $im, (imagesx($im2)-(imagesx($im))), (imagesy($im2))-(imagesy($im)), 0, 0, imagesx($im), imagesy($im));
$last_modified = gmdate('D, d M Y H:i:s T' , filemtime ($image));
header("Last-Modified: $last_modified");
header("Content-Type: image/jpeg");
imagejpeg($im2,NULL,95);
imagedestroy($im);
imagedestroy($im2);
?>
fast way:
just put the
imagecopyfunction call into theif(imagesx(im2) > 250 && imagesy(im2) > 250)long way:
put everything created for the watermark im inside the
if