在PNG图像上添加JPG图像[关闭]

I have two images. One JPG(small size) and another is PNG(large size). I have to create another third JPG image by placing JPG(small size) image on PNG(large size) image and have to store that image in a folder. If anyone know answer then please explain or suggest me link from where I can understand from beginning. Thank You.

Starting with this small image small.jpg

enter image description here

and this large image large.png

enter image description here

Running this:

#!/usr/local/bin/php -f
<?php
   list($width, $height) = getimagesize('small.jpg');
   $src  = imagecreatefromjpeg('small.jpg');
   $dest = imagecreatefrompng('large.png');

   // Copy 
   imagecopy($dest, $src, 300, 20, 0, 0, $width, $height);

   // Write result 
   imagepng($dest,"result.jpg");
?>

gives this

enter image description here