diff --git a/CImage.php b/CImage.php index 2efc8f9..87e0525 100644 --- a/CImage.php +++ b/CImage.php @@ -1227,7 +1227,7 @@ class CImage if (isset($this->filters) && is_array($this->filters)) { foreach ($this->filters as $filter) { - $this->log("Applying filter $filter."); + $this->log("Applying filter {$filter['type']}."); switch ($filter['argc']) { diff --git a/README.md b/README.md index fb739e0..cd2e515 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ Revision history v0.5.x (latest) +* Added option `shortcut, sc` to enable configuration of complex expressions. Fix 2. * Added support for custom convolutions. Fix #49. * Restructured testprograms. Fix #41. * Corrected json on PHP 5.3. Fix #42. diff --git a/webroot/img.php b/webroot/img.php index 04df701..1500d26 100644 --- a/webroot/img.php +++ b/webroot/img.php @@ -5,6 +5,7 @@ */ + /** * Default configuration options, can be overridden in own config-file. * @@ -115,6 +116,25 @@ if (isset($config['default_timezone'])) { +/** + * shortcut, sc - extend arguments with a constant value, defined + * in config-file. + */ +$shortcut = get(array('shortcut', 'sc'), null); + +verbose("shortcut = $shortcut"); + +if (isset($shortcut) + && isset($config['shortcut']) + && isset($config['shortcut'][$shortcut])) { + + parse_str($config['shortcut'][$shortcut], $get); + verbose("shortcut-constant = {$config['shortcut'][$shortcut]}"); + $_GET = array_merge($_GET, $get); +} + + + /** * verbose, v - do a verbose dump of what happens */ diff --git a/webroot/img_config.php b/webroot/img_config.php index 4368c48..1c77bd2 100644 --- a/webroot/img_config.php +++ b/webroot/img_config.php @@ -85,6 +85,15 @@ return array( + /** + * Create custom shortcuts for more advanced expressions. + */ + 'shortcut' => array( + 'sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen", + ), + + + /** * Predefined size constants. *