How to Insert a Signature on the Bottom of an Image in php? -


i want insert signature (saved png file) on bottom of letter (saved jpg file) in php site. used imagecopymerge, creates black image file instead of request. used code too, no result.

function merge($filename_x, $filename_y, $filename_result) {      list($width_x, $height_x) = getimagesize($filename_x);     list($width_y, $height_y) = getimagesize($filename_y);      $image = imagecreatetruecolor($width_x + $width_y, $height_x);      $image_x = imagecreatefromjpeg($filename_x);     $image_y = imagecreatefromgif($filename_y);      imagecopy($image, $image_x, 0, 20, 30, 50, $width_x, $height_x);     imagecopy($image, $image_y, $width_x, 0, 10, 0, $width_y, $height_y);      imagejpeg($image, $filename_result);      imagedestroy($image);     imagedestroy($image_x);     imagedestroy($image_y); }  merge('myimg.jpeg', 'first.gif', 'merged.jpg'); 

please try function, have customized yours.

function merge($filename_x, $filename_y, $filename_result) {     $source = imagecreatefromjpeg($filename_x);     $tobemerged = imagecreatefromgif($filename_y);      //add signature on bottom right     imagecopymerge($source, $tobemerged, imagesx($source) - imagesx($tobemerged), imagesy($source) - imagesy($tobemerged), 0, 0, imagesx($tobemerged), imagesy($tobemerged), 100);     //save merged image     imagejpeg($source, $filename_result);      //destroy image resources free memory     imagedestroy($source); imagedestroy($tobemerged); } merge('myimg.jpeg', 'first.gif', 'merged.jpg'); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -