Is using GD and Image functions the recommended approach for adding a copyright watermark to images uploaded through a PHP form?
Using GD and Image functions is a common and recommended approach for adding a copyright watermark to images uploaded through a PHP form. By using these functions, you can easily manipulate images and overlay text or logos as a watermark to protect your content.
// Load the original image
$image = imagecreatefromjpeg('uploaded_image.jpg');
// Set the copyright text
$copyright = "Copyright © Your Company";
// Set the font size and color
$font_size = 20;
$font_color = imagecolorallocate($image, 255, 255, 255);
// Add the copyright watermark to the image
imagettftext($image, $font_size, 0, 20, 20, $font_color, 'arial.ttf', $copyright);
// Save the modified image with the watermark
imagejpeg($image, 'watermarked_image.jpg');
// Free up memory
imagedestroy($image);