PHP 8.3.4 Released!

image2wbmp

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

image2wbmp输出图象到浏览器或文件。

警告

本函数已自 PHP 7.3.0 起弃用,自 PHP 8.0.0 起移除。强烈建议不要依赖本函数。

说明

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

image2wbmp() 输出或保存为指定 imageWBMP 版本。

参数

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); // 直接输出流
imagedestroy($image);
?>

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top