Issue Bug Closed

#33728Error in Crop Parameter for ImageMagick convert

Florian Weber 02/07/12, 11:22 updated 06/18/15, 11:15

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 . ' ';
}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.