要想实现这个功能,GD扩展必须打开。好了,废话少说。。。。那就直接贴代码。。
<?php
    date_default_timezone_set("PRC");
    for ($t=0;$t<360;$t++) {
        $y=2*cos($t)-cos(2*$t);
        $x=2*sin($t)-sin(2*$t);
        $x+=3;
        $y+=3;
        $x*=70;
        $y*=70;
        $x=round($x);
        $y=round($y);
        $str[]=$x;
        $y=$y+2*(180-$y);
        $x=$y;
        $str[]=$x;
    }
     $im=imagecreate(400, 400);//创建画布400*400
     $black=imagecolorallocate($im, 255, 255, 255);
     $red=imagecolorallocate($im, 255, 0, 0);//设置颜色
     imagepolygon($im, $str, 360, $red);
     imagestring($im, 5, 130, 160, date("Y-m-d H:i:s"), $red);
     imagestring($im, 5, 130, 190, "Content is missing ", $red);
     imagestring($im, 5, 195, 220, "But ", $red);
     imagestring($im, 5, 165, 250, "i love you ", $red);
     $resultNamePath = dirname(dirname(dirname(dirname(__FILE__)))).DIRECTORY_SEPARATOR.'love.jpg';//图片保存地址
     imagegif($im, $resultNamePath);//输出图片
    ?>

 
相关评论(0)
您是不是忘了说点什么?

友情提示:垃圾评论一律封号...

还没有评论,快来抢沙发吧!