imagebmp

(PHP 7 >= 7.2.0, PHP 8)

imagebmpOutput a BMP image to browser or file

Descrição

imagebmp ( GdImage $image , resource|string|null $file = null , bool $compressed = true ) : bool

Outputs or saves a BMP version of the given image.

Parâmetros

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 the compressed arguments is not used.

compressed

Whether the BMP should be compressed with run-length encoding (RLE), or not.

Valor Retornado

Retorna true em caso de sucesso ou false em caso de falha.

Cuidado

However, if libgd fails to output the image, this function returns true.

Changelog

Versão Descrição
8.0.0 image expects a GdImage instance now; previously, a resource was expected.
8.0.0 The type of compressed is bool now; formerly it was int.

Exemplos

Exemplo #1 Saving a BMP file

<?php
// Create a blank image and add some text
$im imagecreatetruecolor(12020);
$text_color imagecolorallocate($im2331491);

imagestring($im155,  'BMP with PHP'$text_color);

// Save the image
imagebmp($im'php.bmp');

// Free up memory
imagedestroy($im);
?>

add a note add a note

User Contributed Notes

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