mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-04 15:17:42 +02:00
rewrote docs. tested. prepare to tag v0.6
This commit is contained in:
43
CImage.php
43
CImage.php
@@ -236,12 +236,19 @@ class CImage
|
||||
* Custom convolution expressions, matrix 3x3, divisor and offset.
|
||||
*/
|
||||
private $convolves = array(
|
||||
'lighten' => '0,0,0, 0,12,0, 0,0,0, 9, 0',
|
||||
'darken' => '0,0,0, 0,6,0, 0,0,0, 9, 0',
|
||||
'sharpen' => '-1,-1,-1, -1,16,-1, -1,-1,-1, 8, 0',
|
||||
'emboss' => '1,1,-1, 1,3,-1, 1,-1,-1, 3, 0',
|
||||
'blur' => '1,1,1, 1,15,1, 1,1,1, 23, 0',
|
||||
'gblur' => '1,2,1, 2,4,2, 1,2,1, 16, 0',
|
||||
'lighten' => '0,0,0, 0,12,0, 0,0,0, 9, 0',
|
||||
'darken' => '0,0,0, 0,6,0, 0,0,0, 9, 0',
|
||||
'sharpen' => '-1,-1,-1, -1,16,-1, -1,-1,-1, 8, 0',
|
||||
'sharpen-alt' => '0,-1,0, -1,5,-1, 0,-1,0, 1, 0',
|
||||
'emboss' => '1,1,-1, 1,3,-1, 1,-1,-1, 3, 0',
|
||||
'emboss-alt' => '-2,-1,0, -1,1,1, 0,1,2, 1, 0',
|
||||
'blur' => '1,1,1, 1,15,1, 1,1,1, 23, 0',
|
||||
'gblur' => '1,2,1, 2,4,2, 1,2,1, 16, 0',
|
||||
'edge' => '-1,-1,-1, -1,8,-1, -1,-1,-1, 9, 0',
|
||||
'edge-alt' => '0,1,0, 1,-4,1, 0,1,0, 1, 0',
|
||||
'draw' => '0,-1,0, -1,5,-1, 0,-1,0, 0, 0',
|
||||
'mean' => '1,1,1, 1,1,1, 1,1,1, 9, 0',
|
||||
'motion' => '1,0,0, 0,1,0, 0,0,1, 3, 0',
|
||||
);
|
||||
|
||||
|
||||
@@ -265,17 +272,17 @@ class CImage
|
||||
* @todo Clean up these and check if and how they are used
|
||||
*/
|
||||
|
||||
//public $keepRatio;
|
||||
//public $cropToFit;
|
||||
//private $cropWidth;
|
||||
//private $cropHeight;
|
||||
//public $crop_x;
|
||||
//public $crop_y;
|
||||
//public $filters;
|
||||
//private $type; // Calculated from source image
|
||||
//private $attr; // Calculated from source image
|
||||
//private $useCache; // Use the cache if true, set to false to ignore the cached file.
|
||||
//private $useOriginal; // Use original image if possible
|
||||
public $keepRatio;
|
||||
public $cropToFit;
|
||||
private $cropWidth;
|
||||
private $cropHeight;
|
||||
public $crop_x;
|
||||
public $crop_y;
|
||||
public $filters;
|
||||
private $type; // Calculated from source image
|
||||
private $attr; // Calculated from source image
|
||||
private $useCache; // Use the cache if true, set to false to ignore the cached file.
|
||||
private $useOriginal; // Use original image if possible
|
||||
|
||||
|
||||
|
||||
@@ -417,6 +424,7 @@ class CImage
|
||||
// Pre-processing, before resizing is done
|
||||
'scale' => null,
|
||||
'rotateBefore' => null,
|
||||
'autoRotate' => false,
|
||||
|
||||
// General options
|
||||
'bgColor' => null,
|
||||
@@ -429,7 +437,6 @@ class CImage
|
||||
'blur' => null,
|
||||
'convolve' => null,
|
||||
'rotateAfter' => null,
|
||||
'autoRotate' => false,
|
||||
|
||||
// Output format
|
||||
'outputFormat' => null,
|
||||
|
10
README.md
10
README.md
@@ -133,6 +133,8 @@ Revision history
|
||||
|
||||
v0.5.x (latest)
|
||||
|
||||
* Rewrote and added documentation.
|
||||
* Moved conolution expressesion from `img_config.php` to `CImage`.
|
||||
* Minor cleaning of properties in `CImage`. Fix #23.
|
||||
* Adding `webroot/htaccess` to show off how friendly urls can be created for `img.php`. Fix #45.
|
||||
* Added option `fill-to-fit, ff`. Fix #38.
|
||||
@@ -159,10 +161,10 @@ v0.5.3 (2014-11-21)
|
||||
* Moving `webroot/test*` into directory `webroot/test`.
|
||||
* `webroot/check_system.php` now outputs if extension for exif is loaded.
|
||||
* Broke API when `initDimensions()` split into two methods, new `initDimensions()` and `loadImageDetails()`.
|
||||
* Added `autoRotate,`aro` to auto rotate image based on EXIF information.
|
||||
* Added `bgColor,`bgc` to use as backgroundcolor when needing a filler color, for example rotate 45.
|
||||
* Added `rotateBefore,`rb` to rotate image a certain angle before processing.
|
||||
* Added `rotateAfter,`ra` to rotate image a certain angle after processing.
|
||||
* Added `autoRotate, aro` to auto rotate image based on EXIF information.
|
||||
* Added `bgColor, bgc` to use as backgroundcolor when needing a filler color, for example rotate 45.
|
||||
* Added `rotateBefore, rb` to rotate image a certain angle before processing.
|
||||
* Added `rotateAfter, ra` to rotate image a certain angle after processing.
|
||||
* Cleaned up code formatting, removed trailing spaces.
|
||||
* Removed @ from opening images, better to display correct warning when failing #34, but put it back again.
|
||||
* Setting gd.jpeg_ignore_warning to true as default #34.
|
||||
|
@@ -141,7 +141,7 @@ $shortcut = get(array('shortcut', 'sc'), null);
|
||||
|
||||
verbose("shortcut = $shortcut");
|
||||
|
||||
if (isset($shortcut)
|
||||
if (isset($shortcut)
|
||||
&& isset($config['shortcut'])
|
||||
&& isset($config['shortcut'][$shortcut])) {
|
||||
|
||||
@@ -285,7 +285,7 @@ if (isset($config['background_color'])) {
|
||||
/**
|
||||
* bgColor - Default background color to use
|
||||
*/
|
||||
$bgColor = get(array('bgColor', 'bgc'), null);
|
||||
$bgColor = get(array('bgColor', 'bg-color', 'bgc'), null);
|
||||
|
||||
verbose("bgColor = $bgColor");
|
||||
|
||||
@@ -444,7 +444,7 @@ verbose("blur = $blur");
|
||||
/**
|
||||
* rotateBefore - Rotate the image with an angle, before processing
|
||||
*/
|
||||
$rotateBefore = get(array('rotateBefore', 'rb'));
|
||||
$rotateBefore = get(array('rotateBefore', 'rotate-before', 'rb'));
|
||||
|
||||
is_null($rotateBefore)
|
||||
or ($rotateBefore >= -360 and $rotateBefore <= 360)
|
||||
@@ -457,7 +457,7 @@ verbose("rotateBefore = $rotateBefore");
|
||||
/**
|
||||
* rotateAfter - Rotate the image with an angle, before processing
|
||||
*/
|
||||
$rotateAfter = get(array('rotateAfter', 'ra', 'rotate', 'r'));
|
||||
$rotateAfter = get(array('rotateAfter', 'rotate-after', 'ra', 'rotate', 'r'));
|
||||
|
||||
is_null($rotateAfter)
|
||||
or ($rotateAfter >= -360 and $rotateAfter <= 360)
|
||||
@@ -470,7 +470,7 @@ verbose("rotateAfter = $rotateAfter");
|
||||
/**
|
||||
* autoRotate - Auto rotate based on EXIF information
|
||||
*/
|
||||
$autoRotate = getDefined(array('autoRotate', 'aro'), true, false);
|
||||
$autoRotate = getDefined(array('autoRotate', 'auto-rotate', 'aro'), true, false);
|
||||
|
||||
verbose("autoRotate = $autoRotate");
|
||||
|
||||
@@ -507,7 +507,7 @@ 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");
|
||||
@@ -522,7 +522,7 @@ $convolve = get('convolve', null);
|
||||
// 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 constant = " . print_r($config['convolution_constant'], 1));
|
||||
}
|
||||
|
||||
verbose("convolve = " . print_r($convolve, 1));
|
||||
@@ -569,6 +569,7 @@ $img->log("Incoming arguments: " . print_r(verbose(), 1))
|
||||
// Pre-processing, before resizing is done
|
||||
'scale' => $scale,
|
||||
'rotateBefore' => $rotateBefore,
|
||||
'autoRotate' => $autoRotate,
|
||||
|
||||
// General processing options
|
||||
'bgColor' => $bgColor,
|
||||
@@ -581,7 +582,6 @@ $img->log("Incoming arguments: " . print_r(verbose(), 1))
|
||||
'blur' => $blur,
|
||||
'convolve' => $convolve,
|
||||
'rotateAfter' => $rotateAfter,
|
||||
'autoRotate' => $autoRotate,
|
||||
|
||||
// Output format
|
||||
'outputFormat' => $outputFormat,
|
||||
|
@@ -88,13 +88,8 @@ return array(
|
||||
* offset.
|
||||
*/
|
||||
'convolution_constant' => array(
|
||||
'edge' => '-1,-1,-1, -1,8,-1, -1,-1,-1, 9, 0',
|
||||
'edge-alt' => '0,1,0, 1,-4,1, 0,1,0, 1, 0',
|
||||
'draw' => '0,-1,0, -1,5,-1, 0,-1,0, 0, 0',
|
||||
'sharpen-alt' => '0,-1,0, -1,5,-1, 0,-1,0, 1, 0',
|
||||
'emboss-alt' => '-2,-1,0, -1,1,1, 0,1,2, 1, 0',
|
||||
'mean' => '1,1,1, 1,1,1, 1,1,1, 9, 0',
|
||||
'motion' => '1,0,0, 0,1,0, 0,0,1, 3, 0',
|
||||
//'sharpen' => '-1,-1,-1, -1,16,-1, -1,-1,-1, 8, 0',
|
||||
//'sharpen-alt' => '0,-1,0, -1,5,-1, 0,-1,0, 1, 0',
|
||||
),
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user