1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-04 15:17:42 +02:00

Added option 'shortcut, sc' to enable configuration of complex expressions. Fix #2.

This commit is contained in:
Mikael Roos
2014-11-28 16:22:24 +01:00
parent 3c04a2dd0f
commit 113b62edc0
4 changed files with 31 additions and 1 deletions

View File

@@ -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']) {

View File

@@ -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.

View File

@@ -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
*/

View File

@@ -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.
*