Project

General

Profile

Actions

Bug #16545

closed

GIFBUILDER indexcolors cropsized images

Added by Sebastian Lenz over 17 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Communication
Target version:
-
Start date:
2006-09-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Giving the gifbuidler the command to cropsize an image makes him convert the image to a gif, even if both source and destination are truecolored images like jpg. The following directive leads to an ugly result, at least in the typo3-version 4.0 im currently running on:

temp.test = IMAGE
temp.test.file {
file = fileadmin/debug/teaser.jpg
file.width = 550c
file.height = 150c
}

As this is a “simple” image-action, the directive is delegated to imageMagickConvert() in class.t3lib_stdgraphic.php. There is a special handling for cropsized images useing, after scaleing the image, a gifbuilder-object in order to create an offest for the the final result. Somewhere along the way, this gifbuilder creates a gif-file out of jpeg files. I simply replaced the gifbuilder-call by another imagemagick-call, working pretty fine for me:

if ($data['crs']) {
if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output, $imagefile)) {
$crsOutput = str_replace('pics/', 'pics/crs-', $output);

$this->imageMagickExec($imagefile.$frame, $output, $command);
if (!$data['origW']) $data['origW'] = $data[0];
if (!$data['origH']) $data['origH'] = $data[1];
$ofX = intval(($info[0] - $data['origW']) / 2 * (($data['cropH'] + 100) / 200));
$ofY = intval(($info[1] - $data['origH']) / 2 * (($data['cropV'] + 100) / 200));
$command = '-crop ' . $data['origW'] . 'x' . $data['origH'] . '+' . $ofX . '+' . $ofY;
$this->imageMagickExec($output, $output, $command);

(issue imported from #M4186)


Files

t3lib_stdgraphic.diff (3.24 KB) t3lib_stdgraphic.diff Administrator Admin, 2006-09-15 08:45
class.t3lib_stdgraphic.diff (3.12 KB) class.t3lib_stdgraphic.diff Administrator Admin, 2006-11-02 22:40
class.t3lib_stdgraphic2.diff (3.23 KB) class.t3lib_stdgraphic2.diff Administrator Admin, 2006-11-02 23:10
class.t3lib_stdgraphic3.diff (2.7 KB) class.t3lib_stdgraphic3.diff Administrator Admin, 2006-11-02 23:52
class.t3lib_stdgraphic4.diff (2.34 KB) class.t3lib_stdgraphic4.diff Administrator Admin, 2006-11-15 13:46
crop_scale.diff (2.64 KB) crop_scale.diff Administrator Admin, 2007-02-27 22:02
bug_4186_cropscale_V2.diff (2.33 KB) bug_4186_cropscale_V2.diff Administrator Admin, 2008-02-24 22:12

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #18566: Image crop does not work in RC1Closed2008-04-05

Actions
Has duplicate TYPO3 Core - Bug #18435: Cropscaling with GIFBUILDER creates PNG/GIF-File with Extension .jpg (Wrong MIME-Type)Closed2008-03-13

Actions
Actions

Also available in: Atom PDF