2
我已經嘗試了許多計算器的答案,但無法得到解決方案我想要的,我的代碼無法正確合併兩個圖像到一個新的圖像。PHP imagecopymerge不能合併JPG和PNG到一個新的圖像
,我不希望使用ImageMagic庫
$height = 527;
$width = 1350;
$back_img = 'http://localhost/testphoto/Mtw2xHqGGd5FkDF2eQ4Z.png';
$front_img = 'http://localhost/testphoto/BHp7zWb8MB18sr8mzY1v________________.png';
$image = imagecreatefromstring(file_get_contents($back_img));
$frame = imagecreatefromstring(file_get_contents($front_img));
$image = imagecreatefrompng($back_img);
$frame = imagecreatefrompng($front_img);
imagecopymerge($frame, $image, 100, 100, 100, 100, 100, $height, $width);
imagepng($image, 'image.png');
看到排名第一的評論在這裏:http://www.php.net/manual/en/function.imagecopymerge.php#92787 –
感謝,但沒有工作,我 複製代碼並運行 ,但是波紋管代碼僅在圖像 中包含'BHp7zWb8MB18sr8mzY1v ________________。png'imagecopy($ cut,$ dst_im,0,0,$ src_x,$ src_y,$ src_w,$ src_h); \t //將相關部分從水印複製到剪切資源 \t imagecopy($ cut,$ src_im,0,0,$ dst_x,$ dst_y,$ src_w,$ src_h);在圖像 imagecopy的($切,$ dst_im和,0,0,$從src_x,$ src_y,$ src_w,$ src_h)的結果 波紋管代碼只 'Mtw2xHqGGd5FkDF2eQ4Z.png'; \t //將相關部分從水印複製到剪切資源 \t imagecopy($ cut,$ src_im,0,0,$ dst_x,$ dst_y,$ src_w,$ src_h); – user3359090
非常感謝@DigitalChris現在的作品! – user3359090