QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2733|回复: 1

php创建图片后,如何设置背景为白色?

[复制链接]
发表于 2006-1-7 14:18:40 | 显示全部楼层 |阅读模式
Header("Content-type:image/png");
$im=imagecreate(620,580);

之后,就是黑色背景,我想要白色背景,如何设置?
发表于 2006-1-7 15:18:32 | 显示全部楼层
多看PHP手册

[code:1]
<?php
header("Content-type: image/png");
$im = @imagecreate(100, 50)
    or die("Cannot Initialize new GD image stream");
// 设置背景颜色...
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
[/code:1]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-20 03:09 , Processed in 0.065899 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表