In the virtual machine, I have installed the imagick component and the fonts to be used. The code for imagick plotting is as follows: {code ...} writing function: {code ...} the problem is that there is no error in the $ draw-& amp; gt; setFont () step, indicating that the font is successfully set, but $ imagick -...
In the virtual machine, I have installed the imagick component and the fonts to be used.
The imagick plot code is as follows:
$ 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, "test", 302,688,130, '#33BAF6 ');
Writing function:
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);}
The problem is,$draw->setFont()No error is reported in this step, indicating that the font is successfully set,$imagick->annotateImage()That is, an error occurred while drawing.
Why is it a font problem?
Note:
1. I am using the vagrant virtual environment for development.
2. the same font is installed in the test environment and the image is successfully written using imagick. (The font of the Test environment is installed by O & M personnel)
Reply content:
In the virtual machine, I have installed the imagick component and the fonts to be used.
The imagick plot code is as follows:
$ 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, "test", 302,688,130, '#33BAF6 ');
Writing function:
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);}
The problem is,$draw->setFont()No error is reported in this step, indicating that the font is successfully set,$imagick->annotateImage()That is, an error occurred while drawing.
Why is it a font problem?
Note:
1. I am using the vagrant virtual environment for development.
2. the same font is installed in the test environment and the image is successfully written using imagick. (The font of the Test environment is installed by O & M personnel)