$openID = "testFileName";
$name = "李小明"."七夕";
//随机事件
$event = array("加班", "被表白", "有艳遇", "结束单身");
//在0-3之间产生随机数
$i = rand(0,3);
$dst_path = "./".$openID.".jpg";
$src_path = './qixi.jpg';
//创建图片的实例
$dst = imagecreatefromstring(file_get_contents($src_path));
//打上文字
$fontS = './font/shouxie.ttf';//字体
$fontZ = './font/simsun.ttc';//字体
$blue = imagecolorallocate($dst, 0x00, 0x00, 0xff);//字体颜色
$black = imagecolorallocate($dst, 0x00, 0x00, 0x00);//字体颜色
//输出名字到图片
imagefttext($dst, 48, 0, 360, 195, $blue, $fontS, $name);
//输出第一行文字到图片
imagefttext($dst, 50, 0, 185, 375, $black, $fontS, $event[$i]);
imagefttext($dst, 50, 0, 185, 485, $black, $fontS, $event[$i]);
imagefttext($dst, 50, 0, 185, 605, $black, $fontS, $event[$i]);
imagefttext($dst, 50, 0, 185, 715, $black, $fontS, $event[$i]);
imagefttext($dst, 50, 0, 185, 835, $black, $fontS, $event[$i]);
//输出图片
imagejpeg($dst, $dst_path);
?>