PHP图像创建功能问题

时间:2011-03-21 02:37:46

标签: php

有人可以列出php的所有图像创建功能吗?

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:-1)

创建200 * 200平方的代码:

<?php
create_image();
print "<img src=image.png?".date("U").">";

function  create_image(){
        $im = @imagecreate(200, 200) or die("Cannot Initialize new GD image stream");
        $background_color = imagecolorallocate($im, 255, 255, 0);  // yellow
        imagepng($im,"image.png");
        imagedestroy($im);
}
?>

绘图线:

<?php
create_image();
print "<img src=image.png?".date("U").">";

function  create_image(){
        $im = @imagecreate(200, 200) or die("Cannot Initialize new GD image stream");
        $background_color = imagecolorallocate($im, 255, 255, 0);   // yellow

        $red = imagecolorallocate($im, 255, 0, 0);                  // red
        $blue = imagecolorallocate($im, 0, 0, 255);                 // blue
        imageline ($im,   5,  5, 195, 5, $red);
        imageline ($im,   5,  5, 195, 195, $blue); 

        imagepng($im,"image.png");
        imagedestroy($im);
}
?>