// Load the original image $original_image = imagecreatefromjpeg('original.jpg'); // Load the watermark image $watermark_image = imagecreatefrompng('watermark.png'); // Get the dimensions of the original image $original_width = imagesx($original_image); $original_height = imagesy($original_image); // Get the dimensions of the watermark image $watermark_width = imagesx($watermark_image); $watermark_height = imagesy($watermark_image); // Set the position of the watermark image within the original image $position_x = $original_width - $watermark_width - 10; // 10px from the right $position_y = $original_height - $watermark_height - 10; // 10px from the bottom // Merge the watermark image with the original image imagecopy($original_image, $watermark_image, $position_x, $position_y, 0, 0, $watermark_width, $watermark_height); // Save the watermarked image imagejpeg($original_image, 'watermarked.jpg'); // Free up memory imagedestroy($original_image); imagedestroy($watermark_image);This code loads an original image and a watermark image and places the watermark image in the bottom right corner of the original image. It then merges the two images and saves the watermarked image. The PHP Image Watermark library can be downloaded from the official PHP website or installed using the Composer package manager.