diff --git a/REVISION.md b/REVISION.md index aaead9b..a0d08b5 100644 --- a/REVISION.md +++ b/REVISION.md @@ -8,8 +8,10 @@ Revision history v0.7.6* (2015-10-20) ------------------------------------- +* Added configuration for default jpeg quality and png compression in the config file, #107. +* Strip comments and whitespace in imgs.php, #115. * Bundle imgs.php did not have the correct mode. -* Adding option &status to get an overview of the installed ond configured utilities, #116. +* Adding option &status to get an overview of the installed on configured utilities, #116. * Bug, all files saved as png-files, when not saving as specific file. * Removed saving filename extension for alias images. * Added option to decide if resample or resize when copying images internally. `&no-resample` makes resize, instead of resample as is default. diff --git a/webroot/img.php b/webroot/img.php index 28623ac..32f9c6b 100644 --- a/webroot/img.php +++ b/webroot/img.php @@ -649,11 +649,16 @@ verbose("use cache = $useCache"); * quality, q - set level of quality for jpeg images */ $quality = get(array('quality', 'q')); +$qualityDefault = getConfig('jpg_quality', null); is_null($quality) or ($quality > 0 and $quality <= 100) or errorPage('Quality out of range'); +if (is_null($quality) && !is_null($qualityDefault)) { + $quality = $qualityDefault; +} + verbose("quality = $quality"); @@ -662,12 +667,16 @@ verbose("quality = $quality"); * compress, co - what strategy to use when compressing png images */ $compress = get(array('compress', 'co')); - +$compressDefault = getConfig('png_compression', null); is_null($compress) or ($compress > 0 and $compress <= 9) or errorPage('Compress out of range'); +if (is_null($compress) && !is_null($compressDefault)) { + $compress = $compressDefault; +} + verbose("compress = $compress"); diff --git a/webroot/img_config.php b/webroot/img_config.php index da51370..acc7200 100644 --- a/webroot/img_config.php +++ b/webroot/img_config.php @@ -109,6 +109,19 @@ return array( + /** + * Change the default values for CImage quality and compression used + * when saving images. + * + * Default value: + * jpg_quality: null, integer between 0-100 + * png_compression: null, integer between 0-9 + */ + //'jpg_quality' => 75, + //'png_compression' => 1, + + + /** * The name representing a dummy image which is automatically created * and stored at the defined path. The dummy image can then be used