Hello Readers if you have two images i.e. one png and one jpg, Then by using PHP you can merge both on a single one.
Lets see the example as given below:-
<?php
# If you don't know the type of image you are using as your originals.
$image = imagecreatefromstring(file_get_contents($your_original_image));
$frame = imagecreatefromstring(file_get_contents($your_frame_image));
# If you know your originals are of type PNG.
$image = imagecreatefrompng($your_original_image);
$frame = imagecreatefrompng($your_frame_image);
imagecopymerge($image, $frame, 0, 0, 0, 0, 50, 50, 100);
# Save the image to a file
imagepng($image, '/path/to/save/image.png');
# Output straight to the browser.
imagepng($image);
?>
In the abouve code one image is $image and another is the $frame. The output of the image will be the single image with image over the frame.
0 Comment(s)