📄 photo_md.php
字号:
<?php
include_once '../../../mainfile.php';
$que = "select store_id,s_name,s_phone from ";
$que.= $xoopsDB->prefix("market_store")." where store_id='".$_REQUEST['s_id0']."' limit 0,1";
$res = $xoopsDB->query($que);
$row = $xoopsDB->fetchArray($res);
$image = "txdyz.png"; //原图
$fnt1 = "fzytk.ttf"; // 字体-方正姚体楷
$fnt2 = "hwxk.ttf"; // 字体-华文行楷
$fnt3 = "hkhbt.ttf"; // 字体-华康海报体
$fnt4 = "ht.ttf"; // 字体-黑体
// echo "<br />编码:".rawurlencode($teststr);
// echo "<br />解码:".rawurldecode(rawurlencode($teststr));
$name = $row['s_name'];
$tel = $row['s_phone'];
$no = $row['store_id'];
$_store_name = ($name == '')?('武汉总代理'):$name;
$_store_tel = ($tel == '')?('027-85835326'):$tel;
$_store_id = ($no == '')?('No.420101f278'):"No.".$no;
$_store_name = substr($_store_name,0,10);
$_len=strlen($_store_name);
$_store_name = iconv("GB2312","UTF-8",$_store_name);
$_store_tel = iconv("GB2312","UTF-8",$_store_tel);
$_store_id = iconv("GB2312","UTF-8",$_store_id);
$size1 = 22;
$size2 = 19;
$size3 = 9;
$angle = 0; //显示角度
header("Content-type: image/png");
$ar = ImageTTFBBox($size, $angle, $fnt1, $_store_tel);
$width = $ar[2];
// $height = max($size,$ar[1]-$ar[5]);
$top = 35;
$left = 15;
$im = imagecreatefrompng($image);
$white = ImageColorAllocate($im, 255,255,255);
$color1 = ImageColorAllocate($im, 145,30,35);
$color2 = ImageColorAllocate($im, 20,185,85);
$color3 = ImageColorAllocate($im, 0,120,0);
/*
for($i=0;$i<5;$i++) {
$color = imagecolorclosestalpha($im,255,255,255,90-$i*10);
imagettftext ($im, $size, $angle, 40-$ar[6], $height-$ar[1]+100*$i, $color, $fnt1, $_store_tel);
}
*/
imagettftext ($im, $size1, $angle+0, $left+(5-$_len/2)*15, $top, $color1, $fnt4, $_store_name);
imagettftext ($im, $size2, $angle+0, $left-1, $top+45, $color2, $fnt4, $_store_tel);
imagettftext ($im, $size3, $angle+0, $left+80, $top+58, $color3, $fnt1, $_store_id);
ImageJPEG($im);
ImageDestroy($im);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -