|
<?php/*创建图片imagecreate — 新建一个基于调色板的图像resource imagecreate ( int $x_size , int $y_size )imagecreatetruecolor 新建一个真彩色图像resource imagecreatetruecolor ( int $x_size , int $y_size )图像分配颜色imagecolorallocate — 为一幅图像分配颜色int imagecolorallocate ( resource $image , int $red , int $green , int $blue )imagecolorallocatealpha — 为一幅图像分配颜色 + alpha(透明度,1-127)int imagecolorallocatealpha ( resource $image , int $red , int $green , int $blue , int $alpha )bool imagecolordeallocate ( resource $image , int $color ) 取消图像颜色的分配在图片上画东东imageline — 画一条线段bool imageline ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )imagestring — 水平地画一行字符串bool imagestring ( resource $image , int $font , int $x , int $y , string $s , int $col )imageloadfont — 载入一新字体int imageloadfont ( string $file )输出图像imagepng — 以 PNG 格式将图像输出到浏览器或文件bool imagepng ( resource $image [, string $filename ] )imagegif(),imagewbmp(),imagejpeg() 和 imagetypes()。销毁一图像imagedestroy — 销毁一图像、bool imagedestroy ( resource $image )取得图像大小array getimagesize ( string $filename [, array &$imageinfo ] )eg:getimagesize("img/flag.jpg"); getimagesize("http://www.example.com/gifs/logo.gif");int imagesx ( resource $image ) - 取得图像宽度int imagesy ( resource $image ) — 取得图像高度*/// 建立一幅图像 大小:100X30//$im = imagecreatefrompng('bg.png');$im = imagecreate(100, 30);// 填充背景 白色背景和蓝色文本$bg = imagecolorallocate($im, 155, 155, 155);$textcolor = imagecolorallocate($im, 0, 0, 255);// 把字符串写在图像左上角imagestring($im, 5, 0, 0, "Hello world!", $textcolor);// 输出图像header("Content-type: image/png");imagepng($im); |
|
|