1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-09-01 03:41:43 +02:00

Added support for custom convolutions. Fix #49.

This commit is contained in:
Mikael Roos
2014-11-27 22:04:41 +01:00
parent 832edc9d26
commit 3c04a2dd0f
5 changed files with 199 additions and 97 deletions

View File

@@ -465,19 +465,35 @@ verbose("json = $outputFormat");
/**
* dpr - change to get larger image to easier support larger dpr, such as retina.
*/
*/
$dpr = get(array('ppi', 'dpr', 'device-pixel-ratio'), 1);
verbose("dpr = $dpr");
/**
* Create the class for the image.
*/
require $config['cimage_class'];
$img = new CImage();
$img->setVerbose($verbose);
/**
* convolve - image convolution as in http://php.net/manual/en/function.imageconvolution.php
*/
$convolve = get('convolve', null);
verbose("convolve = $convolve");
// Check if the convolve is matching an existing constant
if ($convolve && isset($config['convolution_constant'])) {
$img->addConvolveExpressions($config['convolution_constant']);
verbose("convolve = " . print_r($config['convolution_constant'], 1));
}
verbose("convolve = " . print_r($convolve, 1));
@@ -502,14 +518,10 @@ EOD;
/**
* Create and output the image
* Load, process and output the image
*/
require $config['cimage_class'];
$img = new CImage();
$img->setVerbose($verbose)
->log("Incoming arguments: " . print_r(verbose(), 1))
$img->log("Incoming arguments: " . print_r(verbose(), 1))
->setSource($srcImage, $config['image_path'])
->setOptions(
array(