imagebmp

(PHP 7 >= 7.2.0, PHP 8)

imagebmpMuestra o guarda una imagen BMP en el navegador o en un fichero

Descripción

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

Muestra o guarda una versión BMP de la image proporcionada.

Parámetros

image

Un objeto GdImage, retornado por una de las funciones de creación de imágenes, como imagecreatetruecolor().

file

The path or an open stream resource (which is automatically closed after this function returns) to save the file to. If not set or null, the raw image stream will be output directly.

Nota:

null no es válido si el argumento compressed no se utiliza.

compressed

Si el BMP debe ser comprimido con run-length encoding (RLE), o no.

Valores devueltos

Esta función retorna true en caso de éxito o false si ocurre un error.

Precaución

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

Historial de cambios

Versión Descripción
8.0.0 image expects a GdImage instance now; previously, a valid gd resource was expected.
8.0.0 El tipo de compressed es ahora booleano; anteriormente era entero.

Ejemplos

Ejemplo #1 Guardar un fichero BMP

<?php
// Crear una imagen en blanco y añadir texto
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);

imagestring($im, 1, 5, 5, 'BMP con PHP', $text_color);

// Guardar la imagen
imagebmp($im, 'php.bmp');
?>

add a note

User Contributed Notes

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