(PHP 7 >= 7.2.0, PHP 8)
imagebmp — Output a BMP image to browser or file
Outputs or saves a BMP version of the given image
.
image
Um objeto GdImage, retornado por uma das funções de criação de imagem, como imagecreatetruecolor().
file
O caminho ou um recurso de stream aberto (que será fechado automaticamente após o retorno desta função) para salvar o arquivo. Se não for definido ou for null
, o stream da imagem bruta será enviado 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.
Entretanto, se a biblioteca libgd falhar ao gerar a imagem, esta função retornará true
.
Versão | Descrição |
---|---|
8.0.0 |
O parâmetro image agora espera uma instância de GdImage;
anteriormente, um resource gd válido era esperado.
|
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);
?>