PHP.nl

imagexbm

imagexbm

Output an XBM image to browser or file

bool **imagexbm** GdImage $image  $filename  $foreground_color

Outputs or save an version of the given . image

Opmerking: > doesn't apply any padding, so the image width has to be a multiple of 8. This restriction does no longer apply as of PHP 7.0.9. imagexbm

filenameThe path to save the file to, given as string. If null, the raw image stream will be output directly.

   The  (without the .xbm extension) is also
   used for the C identifiers of the , whereby non
   alphanumeric characters of the current locale are substituted by
   underscores. If  is set to null,
    is used to build the C identifiers.
  `filename``filename``image`

foreground_color You can set the foreground color with this parameter by setting an identifier obtained from . The default foreground color is black. All other colors are treated as background. imagecolorallocate

return.success

Voorbeeld: Saving an XBM 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,  'A Simple Text String', $text_color);

// Save the image
imagexbm($im, 'simpletext.xbm');
?>

Voorbeeld: Saving an XBM file with a different foreground color

<?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,  'A Simple Text String', $text_color);

// Set a replacement foreground color
$foreground_color = imagecolorallocate($im, 255, 0, 0);

// Save the image
imagexbm($im, NULL, $foreground_color);
?>