(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
imagecreatefromwbmp — 從檔案或 URL 建立新影像
imagecreatefromwbmp() 會傳回一個影像識別碼,表示從給定檔名取得的影像。
注意: WBMP 影像是無線點陣圖 (Wireless Bitmap),而不是 Windows 點陣圖。後者可以使用 imagecreatefrombmp() 載入。
filename
WBMP 影像的路徑。
成功時傳回影像物件,錯誤時傳回 false
。
範例 #1 處理載入 WBMP 期間錯誤的範例
<?php
function LoadWBMP($imgname)
{
/* 嘗試開啟 */
$im = @imagecreatefromwbmp($imgname);
/* 檢查是否失敗 */
if( !$im )
{
/* 建立空白影像 */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* 輸出錯誤訊息 */
imagestring($im, 1, 5, 5, '載入 ' . $imgname ' 發生錯誤', $tc);
}
return $im;
}
header('Content-Type: image/vnd.wap.wbmp');
$img = LoadWBMP('bogus.image');
imagewbmp($img);
imagedestroy($img);
?>