Issue Bug Closed

#16544GIFBUILDER ignores jpeg-quality

Sebastian Lenz 09/09/06, 03:23 updated 05/03/13, 10:47

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)

Reviews 0

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