(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.
imageEin GdImage-Objekt, das von einer der Funktionen zur Bilderzeugung, z. B. imagecreatetruecolor(), zurückgegeben wurde.
fileDer Pfad oder eine offene Stream-Ressource (die nach der Beendigung dieser Funktion automatisch geschlossen wird), in dem bzw. der die Datei gespeichert werden soll. Falls nicht gesetzt oder null, wird der rohe Bilddatenstrom direkt ausgegeben.
Hinweis:
nullis invalid if thecompressedarguments is not used.
compressedWhether the BMP should be compressed with run-length encoding (RLE), or not.
Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.
Wenn libgd das Bild nicht ausgeben kann, gibt diese Funktion true zurück.
| Version | Beschreibung |
|---|---|
| 8.0.0 |
image erwartet nun eine
GdImage-Instanz; vorher wurde eine gültige
gd-Ressource erwartet.
|
| 8.0.0 |
The type of compressed is Boolean now; formerly it was Integer.
|
Beispiel #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');
?>