【问题标题】:TYPO3 9 - Image generation failed - ImageMagick / GraphicsMagick handling is enabled, but the execute command returned an errorTYPO3 9 - 图像生成失败 - ImageMagick / GraphicsMagick 处理已启用,但执行命令返回错误
【发布时间】:2019-12-30 15:21:50
【问题描述】:

我正在使用图像处理 TCA 类型来处理多种裁剪变体 (https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.6/Feature-75880-ImplementMultipleCroppingVariantsInImageManipulationTool.html)。但是当用户编辑和保存图像时,图像的裁剪版本没有得到保存,我也无法获取裁剪后的图像。

在调试时,我尝试了 TYPO3 图像测试。但多次操作出现以下错误。

图像生成失败 ImageMagick / GraphicsMagick 处理已启用,但执行命令返回错误。请检查您的设置,尤其是 ['GFX']['processor_path'] 和 ['GFX']['processor_path_lzw'] 并确保 Ghostscript 已安装在您的服务器上。

我检查了路径是否正确,服务器上也安装了 Ghostscript。

集成移动图像处理的代码

 'config' => [
                 'type' => 'imageManipulation',
                 'cropVariants' => [
                     'mobile' => [
                         'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
                         'allowedAspectRatios' => [
                             '4:3' => [
                                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                                 'value' => 4 / 3
                             ],
                             'NaN' => [
                                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                                 'value' => 0.0
                             ],
                         ],
                     ],
                     'desktop' => [
                         'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.desktop',
                         'allowedAspectRatios' => [
                             '4:3' => [
                                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                                 'value' => 4 / 3
                             ],
                             'NaN' => [
                                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                                 'value' => 0.0
                             ],
                         ],
                     ],
                 ]
            ]

要渲染作物变种我正在使用以下代码

`<f:image image="{data.image}" cropVariant="mobile" width="800" />`

以下错误,我在进行图像测试时遇到问题

图像生成失败 ImageMagick / GraphicsMagick 处理已启用,但执行命令返回错误。请检查您的设置,尤其是 ['GFX']['processor_path'] 和 ['GFX']['processor_path_lzw'] 并确保 Ghostscript 已安装在您的服务器上。

【问题讨论】:

  • 在安装工具/维护区域你可以找到镜像生成测试。这些有用吗?如果没有:您也可以在维护区找到用于尝试生成的命令。尝试在服务器上执行这些命令,看看是否有结果。
  • 所有类型的图像都会出现此错误吗?或者只是一些。如果只是某些格式导致错误,这些是哪些格式?例如。如果是 pdf 和 eps,这可能是由于您服务器上的 ImageMagick 和 GhostScript 的安全策略造成的。
  • 如果您实际使用的是 ImageMagick 而不是 GraphicsMagick,则可能需要在 ImageMagick 中编辑 policy.xml 文件。见stackoverflow.com/questions/52861946/…
  • @Susi 我遇到了图像生成测试的问题,包括将图像格式转换为 jpg、编写 gif 和 png、缩放图像、组合图像。手动执行该命令时,我收到以下消息。 -bash: /usr/bin/convert: 没有这样的文件或目录
  • @Daniel 我在所有类型的图像中都遇到了这个问题。

标签: typo3 image-manipulation typo3-9.x gfx


【解决方案1】:

我也遇到过这个问题。以上这些都不适合我。 在控制台上运行与 TYPO3 安装工具相同的命令显示错误消息:

convert: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.

最后这对我有用: ImageMagick security policy 'PDF' blocking conversion

【讨论】:

    【解决方案2】:

    @Shabnam:如果你还没有解决这个问题:我遇到了同样的问题,经过一些调试发现它是 Typo3 9 中添加的设置 -auto-orient 作为参数'convert',这就是问题所在。

    如果您在以下文件中删除此设置,您的图像测试可能会成功:

    typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php (change to public $scalecmd = '-geometry';)
    typo3/sysext/core/Classes/Utility/CommandUtility.php (remove $parameters = '-auto-orient ' . $parameters;)
    

    【讨论】:

    • 我尝试了建议的解决方案,但它不适合我。
    【解决方案3】:

    -bash: /usr/bin/convert: No such file or directory 可能由不同的错误导致:

    第一个:
    确实没有可执行文件。
    确保 IM 或 GM 已安装,并在 TYPO3 配置中提供正确的路径。
    可能只是路径错了。

    第二个:
    可执行文件在那里,但网络用户 (apache-user) 无权访问可执行文件。
    确保用户有权访问chmod +x /usr/bin/convert

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-16
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多