Statement on glibc/iconv Vulnerability

imagebmp

(PHP 7 >= 7.2.0, PHP 8)

imagebmpOutput a BMP image to browser or file

Descrizione

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

Outputs or saves a BMP version of the given image.

Elenco dei parametri

image

Una risorsa immagine, restituita da una delle funzioni di creazione immagine, come imagecreatetruecolor().

file

Il percorso in cui salvare il file. Se non è impostato o è null, viene restituito il flusso raw dell'immagine.

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.

Valori restituiti

Restituisce true in caso di successo, false in caso di fallimento.

Attenzione

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

Log delle modifiche

Versione Descrizione
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.

Esempi

Example #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);
?>

add a note

User Contributed Notes

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