image add watermark and compressor in php code example
Example: watermark image php
$targetFilePath='assets/images/targetimage.php';
file_put_contents($targetFilePath,$decoded);
$watermarkImagePath = 'assets/images/watermark/watermark.png';
$watermarkImg = imagecreatefrompng($watermarkImagePath);
$im = imagecreatefrompng($targetFilePath);
$marge_right = 20;
$marge_bottom = 20;
$sx = imagesx($watermarkImg);
$sy = imagesy($watermarkImg);
imagecopy($im, $watermarkImg, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($watermarkImg), imagesy($watermarkImg));
imagepng($im, $targetFilePath);
imagedestroy($im);