Bug #16544

GIFBUILDER ignores jpeg-quality

Added by Sebastian Lenz about 15 years ago. Updated over 8 years ago.

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

0%

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

Description

The TypoScript directive
GIFBUILDER.format = jpg
GIFBUILDER.quality = 50
has no effect on the quality of the rendered image as the function start($conf,$data) in class.tslib_gifbuilder.php doesn’t check the option "quality". The gifbuilder will always return a jpg-file with the quality set in the localconf.php, at least in the typo3-version 4.0 im currently running on.

In order to fix this problem I added the following line to start()

$this->jpegQuality =t3lib_div::intInRange($this->setup['quality'] * 1, 10, 100, $GLOBALS['TYPO3_CONF_VARS']['GFX']['jpg_quality']);

Later on I found an even better solution. As the gifbuilder creates several temporary files while processing an image and also stores them with the quality set in $jpegQuality, I changed the function start() to:

$this->jpegQuality = 100;
$this->jpegOutputQuality = t3lib_div::intInRange($this->setup['quality'] * 1, 10, 100, $GLOBALS['TYPO3_CONF_VARS']['GFX']['jpg_quality']);
$this->cmds['jpg'] = $this->cmds['jpeg'] = '-colorspace RGB -quality 100';

Later in the class, within the function gifBuild() I added the line
$this->jpegQuality = $this->jpegOutputQuality;

just before $this->output() is called. Doing this, image quality enhanced, as all the temporary files now are written with highest jpeg-compression.
(issue imported from #M4185)

Also available in: Atom PDF