-4
A
回答
1
你可以使用GD庫。
// Load the three image files:
$images[1]=imagecreatefromjpeg("file1.jpg");
$images[2]=imagecreatefromjpeg("file2.jpg");
$images[3]=imagecreatefromjpeg("file3.jpg");
// Determine their dimensions.
$totalx=$totaly=0;
for ($ix in $images) {
$img=$images[$ix];
$totalx+=imagesx($img); // get total width
$totaly=max($totaly,imagesy($img)); // get maximum height
}
$xm=20; // side and in-between margin
$ym=20; // top and bottom margin
$totalx+=$xmargin*4; // 2 for the outsides and 2 for the in-betweens
$totaly+=$ymargin*2; // for top and bottom
$i=imagecreatetruecolor($totalx,$totaly);
$xstart=0; // where to place the next image
for ($ix in $images) {
$img=$images[$ix];
$xstart+=$imagesx($img)+$xm; // increase by this image's width plus buffer
imagecopy($i,$img,$xstart,$ym,0,0,imagesx($img),imagesy($img));
}
imagepng($i); // this outputs the image data. if you want to write it to a file you can do that with imagepng($i,$filename).
+0
請記住,您需要使用正確的圖像加載功能。例如,如果源圖像是PNG,那麼您需要使用imagecreatefrompng()而不是imagecreatefromjpeg()。您可以掃描文件名或使用MIME類型來確定圖像格式,然後從*()函數調用相應的圖像 - 有趣的是,這些函數的結尾與MIME類型值匹配!同樣,如果你想輸出非PNG的東西,你必須使用例如imagejpeg($ i)而不是imagepng($ i)。 –
+0
此外,如果您希望圖像在最終圖像中的大小相同,則可以在imagecopy()調用中使用所需的w/h值而不是圖像()和imagesy()。在我的例子中,我推測你想要的圖像尺寸與原來相同。 –
相關問題
- 1. Glance image create stuck in SAVING status
- 2. 調度ec2-create-image cron作業
- 3. PHP Image Upload
- 4. PHP get image src
- 5. PHP Image Resize(gallery)
- 6. PHP Image上傳
- 7. php image upload
- 8. PHP GD Image問題
- 9. PHP text over image foreach
- 10. image magick php,安裝
- 11. PHP Image Upload檢查尺寸
- 12. Summernote Image Upload Not Working(PHP)
- 13. php image type,mozila和IE7
- 14. 在php image中的會話
- 15. isset image upload php not working
- 16. php image上傳到mysql
- 17. PHP Image上傳通過JQUERY
- 18. PHP BASE64 to Image轉換
- 19. Matlab`image(image)= - 1`?
- 20. OpenCV mat * image =(mat *)image
- 21. image/pjpeg和image/jpeg
- 22. background-image url response image
- 23. 使用create-react-app和php索引
- 24. imagecopyresampled left postion image
- 25. MATLAB:Segment Image
- 26. Create vhost conf
- 27. @ Html.EditorFor(Image)
- 28. PHP Image Uploader - 截斷數組後處理?
- 29. Image nut從數據庫中讀取Php
- 30. PHP Image上傳權限問題
的[PHP:GD](http://php.net/manual/en/book.image.php)文檔,[A相關的問題](HTTP://計算器。 com/questions/645582 /如何在圖表中繪製圖表)和[通用Google搜索](https://www.google.com/search?q=php%20make%20graph)可能做好出發點 – castis
這是如此的廣泛?他很清楚自己想做什麼:製作一張包含三張帶邊框圖像的圖像。如果你沒有看到他給出的示例圖像,它只是廣泛的。 –