php ImageMagick exec - draw text 无法按预期工作 - 特殊字符


php ImageMagick exec -draw text doesn't work as expected - special characters

exec($IM_path."convert
    -size 800x300 xc:black  
    -font ".$linktottf."
    -pointsize 16
    -draw '"fill white stroke none decorate underline text 580,28 Kühle Frische, not working'"
    output.png");

上面代码中的"绘制文本"部分不起作用。 输出.png仅显示"Khle"...所以特殊字符、空格、引号一定有问题......

我尝试了很多(转义,不同的引号,反斜杠,...

我现在浪费了很多时间...所以这就是为什么我希望你能帮助我。感谢!

如果你也想画引号,你需要把它们括在不同的引号中,双引号括在单引号中。

label:''"fill white stroke none decorate underline text 580,28 Kühle Frische, not working'"'

至于特殊字符,请尝试将脚本保存为 unix utf-8 格式(像 Textpad 这样的编辑器在显示保存对话框时可以选择将文件保存为这些选项,类似的编辑器应该具有相同的选项(。

并将系统朗设置为使用utf

LANG=en_US.utf-8;

exec("LANG=en_US.utf-8; ".$IM_path."convert -size 800x300 xc:black -font ".$linktottf." -pointsize 16 label:''"fill white stroke none decorate underline text 580,28 Kühle Frische, not working'"' output.png");

看起来你想要"标签"而不是绘制。 它还需要在一行上,否则它会将其解释为单独的命令