首页 > Web开发 > 详细

php imagecreatetruecolor输出字符符或验证码

时间:2015-07-08 12:49:13      阅读:253      评论:0      收藏:0      [点我收藏+]
$img = imagecreatetruecolor(100,100);    //创建真彩图像资源 
$color = imagecolorAllocate($img,200,200,200);   //分配一个灰色 
imagefill($img,0,0,$color);                 // 从左上角开始填充灰色 
header(‘content-type:image/jpeg‘);   //jpg格式 
imagejpeg($img); 

 //显示灰色的方块 

 

 

例二:

imagestring

 

<?php
// 建立一幅 100X30 的图像
$im = imagecreate(100, 30);

// 白色背景和蓝色文本
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// 把字符串写在图像左上角
imagestring($im, 5, 0, 0, "Hello world!", $textcolor);

// 输出图像
header("Content-type: image/png");
imagepng($im);
?>

  

 

 

php imagecreatetruecolor输出字符符或验证码

原文:http://www.cnblogs.com/achengmu/p/4629582.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!