虚拟机中我已安装imagick组件,以及要用到的字体。
如图:
企业网站通用源码是以aspcms作为核心进行开发的asp企业网站源码。企业网站通用源码是一套界面设计非常漂亮的企业网站源码,是2016年下半年的又一力作,适合大部分的企业在制作网站是参考或使用,源码亲测完整可用,没有任何功能限制,程序内核使用的是aspcms,如果有不懂的地方或者有不会用的地方可以搜索aspcms的相关技术问题来解决。网站UI虽然不是特别细腻,但是网站整体格调非常立体,尤其是通观全
0
imagick画图部分代码如下:
<code>
$imagick = new Imagick($template_image);
$draw = new ImagickDraw();
$draw->setFillColor('black');
$draw->setFont('/usr/share/fonts/wqy-microhei.ttc');
$draw->settextencoding('utf-8');
$draw->setFontSize(30);
imagick_add_text($imagick,$draw,"测试", 302, 688, 130,'#33BAF6');</code>写字函数:
<code>function imagick_add_text(&$imagick, &$draw, $text, $x = 0, $y = 0, $font_size = 12, $fill_color = 0, $text_kerning = 0) {
if (isset($font_size))
$draw->setFontSize($font_size);
if (isset($fill_color))
$draw->setFillColor($fill_color);
if (isset($text_kerning))
$draw->setTextKerning($text_kerning);
$imagick->annotateImage($draw, $x, $y, 0, $text);
}</code>现在的问题是,$draw->setFont()这一步是没有报错的,说明字体设置成功了,但是$imagick->annotateImage() 也就是画图这一步出错了。
为什么,是字体问题吗?
注:
1.我使用的是vagrant虚拟环境进行开发。
2.测试环境中安装了相同的字体,并且使用imagick画图写字成功。(测试环境字体是运维人员装的)
虚拟机中我已安装imagick组件,以及要用到的字体。
如图:
imagick画图部分代码如下:
<code>
$imagick = new Imagick($template_image);
$draw = new ImagickDraw();
$draw->setFillColor('black');
$draw->setFont('/usr/share/fonts/wqy-microhei.ttc');
$draw->settextencoding('utf-8');
$draw->setFontSize(30);
imagick_add_text($imagick,$draw,"测试", 302, 688, 130,'#33BAF6');</code>写字函数:
<code>function imagick_add_text(&$imagick, &$draw, $text, $x = 0, $y = 0, $font_size = 12, $fill_color = 0, $text_kerning = 0) {
if (isset($font_size))
$draw->setFontSize($font_size);
if (isset($fill_color))
$draw->setFillColor($fill_color);
if (isset($text_kerning))
$draw->setTextKerning($text_kerning);
$imagick->annotateImage($draw, $x, $y, 0, $text);
}</code>现在的问题是,$draw->setFont()这一步是没有报错的,说明字体设置成功了,但是$imagick->annotateImage() 也就是画图这一步出错了。
为什么,是字体问题吗?
注:
1.我使用的是vagrant虚拟环境进行开发。
2.测试环境中安装了相同的字体,并且使用imagick画图写字成功。(测试环境字体是运维人员装的)
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号