public function hebing(){
global $_W;
$id = $_W['merchuid'];
$merchname = $_W['merch_user']['merchname'];
$starttime = date('Y-m-d H:i:s',$_W['merch_user']['start_time']);
$endtime = date('Y-m-d H:i:s',$_W['merch_user']['end_time']);
$img = "https://".$_SERVER['SERVER_NAME']."/attachment/images/1/merch/5/iPxOTDx06tGKoOT4b54K664UTuns26.png";
$a = $this->zhengdingma($_W['merchuid'],1);
$logo1 = 'https://'.$_SERVER['SERVER_NAME']."/attachment/".$_W['merch_user']['logo'];
$a_im = imagecreatefromstring($a);
$logo_im = imagecreatefromjpeg($logo1);
$img_im = imagecreatefrompng($img);
$m_img1=imagecreatetruecolor(500, 500);
list($s_w,$s_h)=getimagesize($logo1);
list($img_w,$img_h)=getimagesize($img);
$log_img = imagecreatetruecolor($s_w, $s_h);
$white=imagecolorallocate($img_im, 248, 248, 248);
$blue=imagecolorallocate($img_im, 0, 0, 255);
$black=imagecolorallocate($img_im, 0, 0, 0);
$green=imagecolorallocate($img_im, 0, 255, 0);
$gray=imagecolorallocate($img_im, 204, 204, 204);
imagerectangle($img_im, 40, 100, 300, 480, $white);
imagefilledrectangle($img_im,40, 100, 300, 480, $white);
$font = IA_ROOT . "/addons/ewei_shopv2/static/fonts/msyh.ttf";
$merchname1 =$merchname."校服订购";
$time = "征订时间:".$starttime."至".$endtime;
$tixing = $merchname."提醒您:";
$fontSize = 14;
$fontBox = imagettfbbox($fontSize, 0, $font, $merchname1);
imagettftext($img_im, $fontSize, 0, ceil(($img_w - $fontBox[2]) / 2), 45, $white, $font, $merchname1);
imagettftext($img_im, 8, 0,30, 80, $white, $font, $time);
imagettftext($img_im, 12, 0,50, 140, $black, $font, $tixing);
imagettftext($img_im, 9, 0,60, 160, $black, $font, "订购工作开始了,为了方便学生家长,请用");
imagettftext($img_im, 9, 0,60, 185, $black, $font, "微信扫码进行征订!");
imagettftext($img_im, 9, 0,60, 390, $gray, $font, "长按识别小程序码或打开微信扫描进行征订");
imagettftext($img_im, 9, 0,50, 420, $gray, $font, "-此次征订由西安依呀呀文化用品有限公司提供-");
imagecopyresized($img_im, $a_im, 65, 190, 0, 0, 180, 180,420,420);
imagecopyresized($img_im,$logo_im, 126, 250, 0, 0, 62, 62,$s_w,$s_h);
imageellipse($img_im, 157,281,87, 87, $white);
imageellipse($img_im, 157,282,64, 64, $white);
imagefilltoborder($img_im,159, 246,$white,$white);
header("content-type: image/png");
imagepng($img_im);
}
private function imageZoom($image = false, $zoom = 2)
{
$width = imagesx($image);
$height = imagesy($image);
$target = imagecreatetruecolor($width * $zoom, $height * $zoom);
imagecopyresampled($target, $image, 0, 0, 0, 0, $width * $zoom, $height * $zoom, $width, $height);
imagedestroy($image);
return $target;
}
private function imageRadius($target = false, $circle = false)
{
$w = imagesx($target);
$h = imagesy($target);
$w = min($w, $h);
$h = $w;
$img = imagecreatetruecolor($w, $h);
imagesavealpha($img, true);
$bg = imagecolorallocatealpha($img, 255, 255, 255, 127);
imagefill($img, 0, 0, $bg);
$radius = ($circle ? $w / 2 : 20);
$r = $radius;
for( $x = 0; $x < $w; $x++ )
{
for( $y = 0; $y < $h; $y++ )
{
$rgbColor = imagecolorat($target, $x, $y);
if( $radius <= $x && $x <= $w - $radius || $radius <= $y && $y <= $h - $radius )
{
imagesetpixel($img, $x, $y, $rgbColor);
}
else
{
$y_x = $r;
$y_y = $r;
if( ($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y) <= $r * $r )
{
imagesetpixel($img, $x, $y, $rgbColor);
}
$y_x = $w - $r;
$y_y = $r;
if( ($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y) <= $r * $r )
{
imagesetpixel($img, $x, $y, $rgbColor);
}
$y_x = $r;
$y_y = $h - $r;
if( ($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y) <= $r * $r )
{
imagesetpixel($img, $x, $y, $rgbColor);
}
$y_x = $w - $r;
$y_y = $h - $r;
if( ($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y) <= $r * $r )
{
imagesetpixel($img, $x, $y, $rgbColor);
}
}
}
}
return $img;
}