I want to add a small image on anther big image as a watermark with opacity.
I'm using imagecopyresampled
to put image on anther image.
But, how to provide opacity for watermark image.
Please help me.
I'm using this simple example code for add watermark on image without opacity:
<?php
$background = imagecreatefrompng("background.png");
if ($background !== false) {
$watermark = imagecreatefrompng("watermark.png");
// Add watermark on background
imagecopyresampled($background,$watermark,
100, 100, 0, 0,
128, 128, 128, 128);
// Add image header
header("Content-type: image/png");
imagepng($background);
imagedestroy($background);
}
For example:
This is background or main image
This is watermark image
I want this type of output
Is it possible or not in PHP?