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
Hello Sir,
Can i add this watermark in pdf file every page.