(PHP 5, PHP 7)
imagexbm — 锟斤拷 XBM 图锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷
$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 锟芥本锟叫匡拷锟矫★拷