Add Watermark Image in PHP | Create Watermark in PHP

By | February 19, 2016

Add watermark image in PHP its our new tutorial. You can add your watermark image to your image. Now you dont need to open Photoshop and do this. Here is the very simple and short code for adding your image.

addWaterMark("Your path to image");
function addWaterMark($filename){
$logoImage = imagecreatefrompng('logo.png');
$logoWidth=imagesx($logoImage);
$logoHeight=imagesy($logoImage);
$im = imagecreatefromjpeg($filename);
$sx = imagesx($im);
$sy = imagesy($im);
imagecopymerge($im, $logoImage, ($sx-$logoWidth)/2, ($sy-$logoHeight)/2, 0, 0, $logoWidth, $logoHeight, 20);
imagejpeg($im, $filename);
imagedestroy($im);
}


In the above code we have created a function you have to just call the function and pass the filename as the parameter.

Hop you like the above code. If you face any issue than please let me know or comment below

One thought on “Add Watermark Image in PHP | Create Watermark in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *