(PHP 7 >= 7.2.0, PHP 8)
imagebmp — Output a BMP image to browser or file
$image
, resource|string|null $file
= null
, bool $compressed
= true
): bool
Outputs or saves a BMP version of the given image
.
image
Um resource de imagem, retornado por funções de criação de imagens, como imagecreatetruecolor().
file
O caminho ou um resource stream aberto (o qual será automaticamente fechado quando a função retorna) para gravar o arquivo. Se não informado ou null
, os bytes da imagem serão impressos diretamente.
Nota:
null
is invalid if thecompressed
arguments is not used.
compressed
Whether the BMP should be compressed with run-length encoding (RLE), or not.
Retorna true
em caso de sucesso ou false
em caso de falha.
However, if libgd fails to output the image, this function returns true
.
Versão | Descrição |
---|---|
8.0.0 |
image expects a GdImage
instance now; previously, a valid gd resource was expected.
|
8.0.0 |
The type of compressed is bool now; formerly it was int.
|
Exemplo #1 Saving a BMP file
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'BMP with PHP', $text_color);
// Save the image
imagebmp($im, 'php.bmp');
// Free up memory
imagedestroy($im);
?>