Am developing new photography website in which images are uploaded frequently.... Now I want to add watermark on uploaded images before it goes to client side, I have used the following code for watermark
$SourceFile = "sys\img\image1.jpg";
$DestinationFile = "sys\img\image1-wm.jpg";
$WaterMarkText = 'Copyright sys.com';
watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile);
function watermarkImage ($SourceFile, $WaterMarkText, $DestinationFile) {
list($width, $height) = getimagesize($SourceFile);
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($SourceFile);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$font = 'arial.ttf';
$font_size = 10;
imagettftext($image_p, $font_size, 0, 10, 20, $black, $font, $WaterMarkText);
if ($DestinationFile<>'') {
imagejpeg ($image_p, $DestinationFile, 100);
} else {
header('Content-Type: image/jpeg');
imagejpeg($image_p, null, 100);
};
imagedestroy($image);
imagedestroy($image_p);
};
But it showing the following error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your
request.
Please contact the server administrator to inform of the time the error occurred and of anything
you might have done that may have caused the error.
More information about this error may be available in the server error log.
What is the mistake I have done...?