What are the advantages and disadvantages of using JPEG as a watermark in PHP image processing?

When using JPEG as a watermark in PHP image processing, one advantage is that JPEG files are widely supported and can be easily displayed on various platforms. However, a disadvantage is that JPEG compression may degrade the quality of the watermark, making it less visible or sharp in the final image.

// Example PHP code snippet for adding a JPEG watermark to an image
$sourceImg = imagecreatefromjpeg('source.jpg');
$watermarkImg = imagecreatefromjpeg('watermark.jpg');

$watermarkWidth = imagesx($watermarkImg);
$watermarkHeight = imagesy($watermarkImg);

// Calculate the position for the watermark
$destX = imagesx($sourceImg) - $watermarkWidth - 10;
$destY = imagesy($sourceImg) - $watermarkHeight - 10;

// Apply the watermark to the source image
imagecopy($sourceImg, $watermarkImg, $destX, $destY, 0, 0, $watermarkWidth, $watermarkHeight);

// Output the image with the watermark
header('Content-Type: image/jpeg');
imagejpeg($sourceImg);

// Clean up
imagedestroy($sourceImg);
imagedestroy($watermarkImg);