1

I am using image manipulation TCA type to handle multiple crop variants(https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.6/Feature-75880-ImplementMultipleCroppingVariantsInImageManipulationTool.html). But when a user edits and saves the image, the cropped version of the image is not getting saved and also I am not able to fetch the cropped image.

While debugging that, I tried TYPO3 image test. But getting following error for multiple operations.

Image generation failed ImageMagick / GraphicsMagick handling is enabled, but the execute command returned an error. Please check your settings, especially ['GFX']['processor_path'] and ['GFX']['processor_path_lzw'] and ensure Ghostscript is installed on your server.

I checked the path is right and Ghostscript is also installed on the server.

Code to integrate mobile image manipulation

 '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
                             ],
                         ],
                     ],
                 ]
            ]

To Render Crop varient I am using following code

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

Following error, I am getting while doing Image test

Image generation failed ImageMagick / GraphicsMagick handling is enabled, but the execute command returned an error. Please check your settings, especially ['GFX']['processor_path'] and ['GFX']['processor_path_lzw'] and ensure Ghostscript is installed on your server.

Deni J.
  • 1,211
  • 3
  • 21
  • In the Install Tool / Maintenance area you can find the image generation tests. Do those work? If not: you can find the commands used to try generation in the maintenance area, too. Try to execute these commands on the server and see whether they have any result. – Susi Aug 26 '19 at 12:25
  • Does this error occur with all types of images? Or just with some. If just some formats result in the error, which formats are these? E.g. if it's pdf and eps, this might be due to security policies with ImageMagick and GhostScript on your server. – Daniel Aug 26 '19 at 12:26
  • It is a possibility that you need to edit your policy.xml file in ImageMagick, if you are actually using ImageMagick and not GraphicsMagick. See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Aug 26 '19 at 21:07
  • @Susi I am getting the issue with image generation tests including Convert image formats to jpg, Writing gif and png, Scaling images, Combining images. I am getting following message when manually execute that command. -bash: /usr/bin/convert: No such file or directory – Shabnam Khan Aug 27 '19 at 06:58
  • @Daniel I am getting this issue with all types of images. – Shabnam Khan Aug 27 '19 at 06:59
  • @ShabnamKhan that means it doesn't find your image/graphicsmagick installation. check your settings for that. Easiest way is to go to "Settings" > "Configuration Presets" > "Image Handling Settings" and adjust these to the matching values on your server. – Susi Aug 27 '19 at 17:19

3 Answers3

1

-bash: /usr/bin/convert: No such file or directory can result from different errors:

1st:
there really is no executable.
Make sure IM or GM is installed and provide the correct path in the TYPO3 configuration.
Maybe only the path is wrong.

2nd:
the executable is there, but the web-user (apache-user) has no access to the executables.
Make sure the user has access like chmod +x /usr/bin/convert

Bernd Wilke πφ
  • 8,555
  • 1
  • 13
  • 32
0

@Shabnam: if you didn't solve this issue yet: I had the same problem and after some debugging found out it is the setting -auto-orient that was added in Typo3 9 as parameter to 'convert', that was causing the problem.

If you remove this setting in the following files, your image tests will probably succeed:

typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php (change to public $scalecmd = '-geometry';)
typo3/sysext/core/Classes/Utility/CommandUtility.php (remove $parameters = '-auto-orient ' . $parameters;)
Watercayman
  • 6,940
  • 10
  • 27
  • 42
0

I also came across this question. None of the above things worked for me. Running the same command as the TYPO3 install tool on console showed an error message:

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

In the end this worked for me: ImageMagick security policy 'PDF' blocking conversion