GD 関数
PHP Manual

imagewbmp

(PHP 4 >= 4.0.1, PHP 5)

imagewbmpブラウザまたはファイルにイメージを出力する

説明

bool imagewbmp ( resource $image [, string $filename [, int $foreground ]] )

imagewbmp() は、指定した imageWBMP にして出力あるいは保存します。

パラメータ

image

imagecreatetruecolor() のような画像作成関数が返す画像リソース。

filename

保存するファイルへのパス。省略したり NULL を設定したりした場合は、 生の画像ストリームを直接出力します。

foreground

このパラメータで、 前景の色を指定できます。imagecolorallocate() で 取得した ID を使用してください。デフォルトの前景色は黒です。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例1 WBMP 画像の出力

<?php
// 空の画像を作成してテキストを追加します
$im imagecreatetruecolor(12020);
$text_color imagecolorallocate($im2331491);
imagestring($im155,  'A Simple Text String'$text_color);

// content type ヘッダを設定します - ここでは image/vnd.wap.wbmp
// ヒント: image_type_to_mime_type() で content-types を取得します
header('Content-type: image/vnd.wap.wbmp');

// 画像を出力します
imagewbmp($im);

// メモリを開放します
imagedestroy($im);
?>

例2 WBMP 画像の保存

<?php
// 空の画像を作成してテキストを追加します
$im imagecreatetruecolor(12020);
$text_color imagecolorallocate($im2331491);
imagestring($im155,  'A Simple Text String'$text_color);

// 画像を保存します
imagewbmp($im'simpletext.wbmp');

// メモリを開放します
imagedestroy($im);
?>

例3 別の前景での画像の出力

// 空の画像を作成してテキストを追加します
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// content type ヘッダを設定します - ここでは image/vnd.wap.wbmp
// ヒント: image_type_to_mime_type() で content-types を取得します
header('Content-type: image/vnd.wap.wbmp');

// 別の前景色を設定します
$foreground_color = imagecolorallocate($im, 255, 0, 0);

imagewbmp($im, NULL, $foreground_color);

// メモリを開放します
imagedestroy($im);

注意

注意: WBMP サポートは、PHP を GD-1.8 以降と組み合わせてコンパイルした 場合にのみ利用可能です。

参考


GD 関数
PHP Manual
アダルトレンタルサーバー