imagexbm

(PHP 5, PHP 7)

imagexbm — �� XBM ͼ���������������ļ�

˵��

imagexbm ( resource $image , string $filename [, int $foreground ] ) : bool

�� XBM ͼ�� image �������������ļ�

����

image

��ͼ�󴴽�����(����imagecreatetruecolor())���ص�ͼ����Դ��

filename

�ļ������·�������δ���û�Ϊ NULL������ֱ�����ԭʼͼ������

foreground

����Դ� imagecolorallocate() ����һ����ɫ��������Ϊ��ǰ��ɫ������ Ĭ����ɫ�Ǻ�ɫ��

����ֵ

�ɹ�ʱ���� TRUE�� ������ʧ��ʱ���� FALSE��

����

Example #1 ����һ�� XBM �ļ�

<?php
// �����հ�ͼ���������
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// ����ͼ��
imagexbm($im, 'simpletext.xbm');

// �ͷ��ڴ�
imagedestroy($im);
?>

Example #2 �Բ�ͬǰ��ɫ����һ�� XBM �ļ�

<?php
// �����հ�ͼ���������
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// �����滻��ǰ��ɫ
$foreground_color = imagecolorallocate($im, 255, 0, 0);

// ����ͼ��
imagexbm($im, NULL, $foreground_color);

// �ͷ��ڴ�
imagedestroy($im);
?>

ע��

Note: �˺��������� GD ���������� PHP �汾�п��á�