|
@@ -84,6 +84,7 @@ class Image
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ header("Content-Type:image/png");
|
|
|
imagepng($this->target, $path . $file);
|
|
|
imagedestroy($this->target);
|
|
|
|
|
@@ -109,14 +110,13 @@ class Image
|
|
|
|
|
|
public function mergeText($data, $text)
|
|
|
{
|
|
|
- $font = ROOT_PATH . '/public/assets/fonts/SourceHanSansK-Regular.ttf';
|
|
|
-// $font = ROOT_PATH . '/public/assets/fonts/lato/lato-black.ttf';
|
|
|
+// $font = ROOT_PATH . 'public/assets/fonts/SourceHanSansK-Regular.ttf';
|
|
|
+ $font = ROOT_PATH . '/public/assets/fonts/fangzheng.ttf';
|
|
|
|
|
|
if (!isset($data['color'])) {
|
|
|
$data['color'] = '#000';
|
|
|
}
|
|
|
|
|
|
- $text = mb_convert_encoding($text, "GB2312", "UTF-8");
|
|
|
$colors = $this->hex2rgb($data['color']);
|
|
|
$color = imagecolorallocate($this->target, $colors['red'], $colors['green'], $colors['blue']);
|
|
|
imagettftext($this->target, $data['size'], 0, $data['left'], $data['top'] + $data['size'], $color, $font, $text);
|