(PHP 7 >= 7.2.0, PHP 8)
imagebmp — 將 BMP 影像輸出至瀏覽器或檔案
輸出或儲存給定 image
的 BMP 版本。
image
一個 GdImage 物件,由影像建立函式之一返回,例如 imagecreatetruecolor()。
file
儲存檔案的路徑或開啟的串流資源(此函式返回後將自動關閉)。如果未設定或為 **null
**,則會直接輸出原始影像串流。
注意事項:
如果未使用
compressed
參數,則 **null
** 無效。
compressed
BMP 影像是否應使用執行長度編碼 (RLE) 進行壓縮。
範例 #1 儲存 BMP 檔案
<?php
// 建立空白影像並新增一些文字
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, '使用 PHP 建立的 BMP', $text_color);
// 儲存影像
imagebmp($im, 'php.bmp');
// 釋放記憶體
imagedestroy($im);
?>