[請益] 圖片合成
想請問板上高手
目前我有photo1, photo2, photoframe 三張圖
我現在要把photo1, photo2 塞入 photoframe 這張底圖挖空的部份
但是不管我怎麼做 photo2 會把 photo1 覆蓋過去
意思就是 photo1 那個挖空的位置會變成一片黑,想要麻煩板上高手替我看一下
以下為程式碼:
<?
// File and rotation
$degrees1 = 18;
$degrees2 = -12;
//photo1
//*****************************************************************************************
$photo1 = imagecreatefromjpeg('1139817060.jpg');
$fotoW1 = 172;
$fotoH1 = 132;
// Rotate
$test = imagecreatetruecolor($fotoW1,$fotoH1);
imagecopyresampled($test, $photo1, 0, 0, 0, 0, $fotoW1, $fotoH1, imagesx($photo1), imagesy($photo1));
$photo1 = imagerotate($test, $degrees1, 0);
//*****************************************************************************************
//photo2
//*****************************************************************************************
$photo2 = imagecreatefromjpeg('1139817060.jpg');
$fotoW2 = 172;
$fotoH2 = 132;
// Rotate
$test = imagecreatetruecolor($fotoW2,$fotoH2);
imagecopyresampled($test, $photo2, 0, 0, 0, 0, $fotoW2, $fotoH2, imagesx($photo2), imagesy($photo2));
$photo2 = imagerotate($test, $degrees2, 0);
//*****************************************************************************************
$photoFrame = imagecreatefrompng('11.png');
$logoImage = imagecreatefrompng('001(1).png');
imagecopy($photoFrame, $photo1, 0, 0, -240, -143, 800, 600);
imagecopy($photoFrame, $photo2, 0, 0, -470, -310, 800, 600);
$logoW = imagesx($logoImage);
$logoH = imagesy($logoImage);
imagecopy($photoFrame, $logoImage, 0, 0, 0, 0, $logoW, $logoH);
imagepng($photoFrame,'',9);
?>
請指教...謝謝...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.21.120.81
推
11/11 16:38, , 1F
11/11 16:38, 1F
→
11/11 16:38, , 2F
11/11 16:38, 2F
→
11/11 16:44, , 3F
11/11 16:44, 3F
→
11/11 16:44, , 4F
11/11 16:44, 4F
推
11/11 16:50, , 5F
11/11 16:50, 5F
→
11/11 16:56, , 6F
11/11 16:56, 6F
→
11/11 16:57, , 7F
11/11 16:57, 7F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章