« image_type_to_mime_type
imageaffine »

image2wbmp

(PHP 4 >= 4.0.5, PHP 5, PHP 7)

image2wbmp — 画像をブラウザあるいはファイルに出力する

警告

この関数は PHP 7.3.0 で 非推奨 になり、PHP 8.0.0 で 削除 されました。この関数に頼らないことを強く推奨します。

説明

function image2wbmp(resource $image, string $filename = ?, int $foreground = ?): bool

image2wbmp() は、イメージ im から filename に WBMP ファイルを作成します。

パラメータ

image

imagecreatetruecolor() のような、 画像を生成する関数から返される画像リソース。

filename

保存されるファイルへのパス。指定しなかった場合は、生の画像ストリームが直接出力されます。

foreground

imagecolorallocate() から取得した識別子をこのパラメータに設定することで、 フォアグラウンドカラーを設定できます。 デフォルトのフォアグラウンドカラーは黒です。

戻り値

成功した場合に true を、失敗した場合に false を返します。

警告

しかしながら、libgd がイメージの出力に失敗した場合、この関数は true を返します。

例

例1 image2wbmp() の例

<?php
$file = 'php.png';
$image = imagecreatefrompng($file);

header('Content-Type: ' . image_type_to_mime_type(IMAGETYPE_WBMP));
image2wbmp($image); // ストリームを直接出力します。
?>

参考

  • imagewbmp() - 画像をブラウザあるいはファイルに出力する
関連キーワード:
image   画像   wbmp   ブラウザ   type   filename   mime   foreground   イメージ   ストリーム   グラウンド   カラー   imageaffine   Image   非推奨   推奨   resource   imagecreatetruecolor   リソース   imagecolorallocate   識別子   成功   libgd   imagecreatefrompng   header
関連する関数・ページ:
function.png2wbmp   function.imagewbmp   function.jpeg2wbmp   function.ps-open-image-file   function.ps-open-memory-image   function.ps-close-image