Project

General

Profile

Actions

Bug #80208

closed

ImageMagick commands fail if stripProfile is set to 0 and GFX[processor_stripColorProfileByDefault] is disabled

Added by Paul Golmann over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Generation / GIFBUILDER
Target version:
Start date:
2017-03-09
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

Problem

When disabling [GFX][processor_stripColorProfileByDefault] in the global configuration and setting stripProfile = 0 for an imgResource in TypoScript or when using the "keep metadata" option in the extension image_autoresize the image does not get processed.

Reproduction

Tested on fresh installations of TYPO3 v6.2.30 with ImageMagick 6.8.7-0 2014-11-14 and TYPO3 v8.6.0 with ImageMagick 6.8.9-9 Q16 x86_64.

setup

1. Set [GFX][processor_stripColorProfileByDefault] = 0 (or [GFX][im_useStripProfileByDefault] = 0 for TYPO3 v6) in Installtool or Localconfiguration.php
2. Upload a test JPEG image to fileadmin (greater than 100x100 px called test.jpg)
2. Create a new page, add a sys_template, add the following setup:

page = PAGE
page {
  10 = IMAGE
  10 {
    file = fileadmin/test.jpg
    file {
      width = 100c
      height = 100c
      stripProfile = 0
    }
  }
}

3. View the page

expected output

The test image cropped to 100x100 pixels.

actual result

The unprocessed test image.

Further information

I tracked the call stack to the CommandUtility in which the marker ###SkipStripProfile### introduced by the ContentObject ends up. In the case that stripping the profile by default is disabled in the global configuration the actual command is something like (depending on the other GFX settings and acutal size of test image):

'/usr/bin/convert' -geometry 100x140! ###SkipStripProfile### -crop 100x100+0+20! '/var/www/html/fileadmin/test.jpg[0]' '/var/www/html/typo3temp/pics/01a24339bf.jpg'
, which produces the following error for me, when testing it directly on the command line:
convert: missing an image filename `100x140!' @ error/convert.c/ConvertImageCommand/3207.

. But should be something like the following, not having the marker in it:
'/usr/bin/convert' -geometry 100x140! -crop 100x100+0+20! '/var/www/html/fileadmin/test.jpg[0]' '/var/www/html/typo3temp/pics/01a24339bf.jpg'

Actions #1

Updated by Paul Golmann over 7 years ago

I've committed a patch for master (https://review.typo3.org/#/c/51990/), but the solution for 6.2 should be quite similar, if this should be backported:

// strip profile information for thumbnails and reduce their size
if ($parameters && $command != 'identify') {
    // Determine whether the strip profile action has be disabled by TypoScript:
    if ($gfxConf['im_useStripProfileByDefault']
        && $gfxConf['im_stripProfileCommand'] != ''
        && strpos($parameters, $gfxConf['im_stripProfileCommand']) === FALSE
        && $parameters !== '-version'
        && strpos($parameters, '###SkipStripProfile###') === FALSE
    ) {
        $parameters = $gfxConf['im_stripProfileCommand'] . ' ' . $parameters;
    } else {
        $parameters = str_replace('###SkipStripProfile###', '', $parameters);
    }
}

Actions #2

Updated by Paul Golmann over 7 years ago

  • Target version set to 8 LTS
Actions #3

Updated by Benni Mack about 7 years ago

  • Target version changed from 8 LTS to next-patchlevel
Actions #4

Updated by Gerrit Code Review about 7 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51990

Actions #5

Updated by Gerrit Code Review about 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51990

Actions #6

Updated by Susanne Moog over 6 years ago

  • Category changed from Image Cropping to Image Generation / GIFBUILDER
Actions #7

Updated by Gerrit Code Review over 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51990

Actions #8

Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55979

Actions #9

Updated by Paul Golmann over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF