Questions about GD function merging images (one jpg and one png)

Source: Internet
Author: User
Tags imagecopy
GD function merging image problem (one jpg, one png) RT: How can I synthesize two images using php? One is a png & nbsp; transparent basemap, and the other is a jpg & nbsp; image. now we want to make the jpg image synthetic to the png basemap and become a new image, how to implement it? In addition, I would like to ask if the synthesized image requires GD function to synthesize the image (one jpg and one png)
RT:
How can I use php to synthesize two images?
One is a png transparent basemap and the other is a jpg image.

Now, how can I merge jpg images into a png basemap and create a new image?

In addition, is the size of the synthesized image the same as that of the image? Or can the basemap be larger?

I also found some methods on the Internet, but none of them seem to work.

  $path_1 = "topic_assets/522592b5d61cb_ip4.jpg";
  $path_2 = "topic_assets/topic_border_android.png";
//echo $path_1;
$image=imagecreatefromjpeg($path_1);  
$wm=imagecreatefrompng($path_2);   
$im=imagecreatetruecolor(imagesx($image),imagesy($image));   
imagecopy($im,$image,0,0,0,0,imagesx($image),imagesy($image));   
imagecopy($im,$wm,0,0,0,0,imagesx($wm),imagesy($wm));


If you have done something similar, give a solution... share it:
------ Solution --------------------
GD provides many functions. you have to try them all! How about this?
$t1 = 'http://avatar.csdn.net/1/C/9/1_mahuatengbc.jpg';
$t2 = 'http://avatar.csdn.net/2/5/B/1_yykr1987.jpg';

$im1 = imagecreatefromjpeg($t1);
$im2 = imagecreatefromjpeg($t2);

imagecopymerge($im1, $im2, 35, 5, 0, 0, imagesx($im2), imagesy($im2), 63);

imagejpeg($im1);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.