How can i merge 2 png images, or a JPEG over a png? I have this image:
The result would have to be like this:
Is there a lightweight library that can do this, or is it possible with php functions? I just want to keep the overlay image withing the background (margin of 10px) - i like to integrate it into my api.. so i can create them on the fly - or store them for later, but being able to create/batch create them online.
Try using the Intervention Image PHP library, more specifically the insert function.
From the documentation:
Paste a given image source over the current image with an optional position and a offset coordinate. This method can be used to apply another image as watermark because the transparency values are maintained.
And an example:
// create new Intervention Image
$bg = Image::make('public/background.jpg');
// create a new Image instance for inserting
$logo = Image::make('public/logo_discovery.png');
// Insert the logo onto the background
$bg->insert($logo, 'center');