Project

General

Profile

Actions

Bug #33728

closed

Error in Crop Parameter for ImageMagick convert

Added by Florian Weber almost 13 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Cropping
Target version:
-
Start date:
2012-02-07
Due date:
% Done:

0%

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

Description

While executing a crop with the ImageMagick convert and the picture is bigger on either width or height but smaller at the other parameter, the convert command is not able to process correctly.
It results in 1 negative and 1 positive Offset for the Crop parameter.
To Solve the Problem you have to make sure both offsets for the Crop Parameter are either positive or negative.

You can achive this by extending the if queries at \t3lib\class.t3lib_stdgraphic.php line 2274-2284 like this:

// Cropscaling:
if ($data['crs']) {
    if (!$data['origW'] || ($data['origW']>$data[0] && $data['origH']<$data[1])) {
        $data['origW'] = $data[0];
    }
    if (!$data['origH'] || ($data['origW']<$data[0] && $data['origH']>$data[1])) {
        $data['origH'] = $data[1];
    }
    $offsetX = intval(($data[0] - $data['origW']) * ($data['cropH'] + 100) / 200);
    $offsetY = intval(($data[1] - $data['origH']) * ($data['cropV'] + 100) / 200);
    $params .= ' -crop ' . $data['origW'] . 'x' . $data['origH'] . '+' . $offsetX . '+' . $offsetY . ' ';
}

Actions

Also available in: Atom PDF