Contains graphics factory and tools. Collects actions with "add"-methods.
Definition at line 41 of file Graphics.php.
Public Member Functions | |
| __construct ($options=array()) | |
| graphics class constructor | |
| canRead ($ext) | |
| Checks if extension support reading file type. | |
| canWrite ($ext) | |
| Checks if extension supports writing file type. | |
| addBackground ($background) | |
| Background "action". | |
| addCrop ($width, $height, $x=0, $y=0) | |
| Adds crop action. | |
| addResize ($width, $height) | |
| Adds resize action. | |
| addThumb ($width, $height) | |
| Adds thumb action. | |
| addThumbfill ($width, $height, $centerX=50, $centerY=50) | |
| Adds thumb-fill action. | |
| render ($input, $output=null) | |
| Main method for image handling. | |
| renderFinished () | |
| Called after rendering has finished. | |
| optimizeImage ($filename) | |
| Opimizes final image through one of the optimization programs. | |
| setQuality ($quality) | |
| Sets quality parameter. | |
| getPageNumber () | |
| getPageNumber | |
Static Public Member Functions | |
| static | factory ($options=array()) |
| graphics object factory | |
| static | which ($binary) |
| Executes "which" command. | |
Protected Member Functions | |
| escapeNumber ($number) | |
| Validates integers. | |
| dimensions ($width, $height) | |
| Scales image dimensions. | |
| processQueue () | |
| Process action queue. | |
| lock () | |
| lock | |
| unlock () | |
| unlock | |
| obtainFormat ($fileName) | |
| Determines image format from file extension. | |
| getQuality () | |
| Returns quality-index for current image format. | |
| bypassTest ($width, $height, $x=0, $y=0) | |
| Tests if action would change current image. | |
| bypass () | |
| Runs bypass (copies file) | |
Protected Attributes | |
| $input | |
| Input filename. | |
| $output | |
| Output filename. | |
| $format | |
| Output format. | |
| $outputLockFp = null | |
| $otherRender = false | |
| otherRender is set to true if another render process has already locked file | |
| $queue = array() | |
| Action queue array. | |
| $size = array() | |
| Image size array(width, height) | |
| $background | |
| Image background string. | |
| $quality = '' | |
| Image quality string. | |
| $optimize | |
| Optimize output images. | |
| $optimizers | |
| List of optimizer binaries. | |
| $limits = [] | |
| limits (mainly for imagemagick and graphicsmagick) | |
| $inputFormat | |
| Input image format. | |
| $outputFormat | |
| Output image format. | |
| $bypass = true | |
| Process bypass bool. | |
| __construct | ( | $options = array() | ) |
| array | $options | image processing parameters |
Reimplemented in Imagemagick.
Definition at line 157 of file Graphics.php.
| addBackground | ( | $background | ) |
Sets image background.
| string | $background | image background |
Definition at line 208 of file Graphics.php.
| addCrop | ( | $width, | |
| $height, | |||
| $x = 0, | |||
| $y = 0 ) |
Adds crop action to action queue.
| int | $width | output width |
| int | $height | output height |
| int | $x | crop x-offset |
| int | $y | crop y-offset |
Definition at line 225 of file Graphics.php.
| addResize | ( | $width, | |
| $height ) |
Adds resize action to action queue.
| int | $width | output width |
| int | $height | output height |
Definition at line 240 of file Graphics.php.
| addThumb | ( | $width, | |
| $height ) |
Adds thumb action to action queue.
| int | $width | output width |
| int | $height | output height |
Definition at line 255 of file Graphics.php.
| addThumbfill | ( | $width, | |
| $height, | |||
| $centerX = 50, | |||
| $centerY = 50 ) |
Adds thumb-fill action to action queue.
| int | $width | output width |
| int | $height | output height |
| int | $centerX | center of image from left in percent |
| int | $centerY | center of image from top in percent |
Definition at line 272 of file Graphics.php.
|
protected |
Definition at line 579 of file Graphics.php.
|
protected |
| int | $width | output width |
| int | $height | output height |
| int | $x | crop x-offset |
| int | $y | crop y-offset |
Definition at line 551 of file Graphics.php.
| canRead | ( | $ext | ) |
| string | $ext | file extension |
Reimplemented in Imagemagick, and Imagick.
Definition at line 184 of file Graphics.php.
| canWrite | ( | $ext | ) |
| string | $ext | file extension |
Definition at line 194 of file Graphics.php.
|
protected |
If either width or height is not set, it calculates the other, preserving the ratio of the origіnal image.
| int | $width | output width |
| int | $height | output height |
Definition at line 301 of file Graphics.php.
|
protected |
Tests integers, returns only integers or null.
| int | $number | int to check |
Definition at line 287 of file Graphics.php.
|
static |
Generates various graphics objects depending on extension type (default is PHP GD)
| array | $options | image processing parameters |
Definition at line 116 of file Graphics.php.
| getPageNumber | ( | ) |
|
protected |
Checks plausibility of quality index for current image format. Returns default value if invalid. (PNG & JPG have different systems)
Reimplemented in Imagemagick.
Definition at line 488 of file Graphics.php.
|
protected |
Definition at line 391 of file Graphics.php.
|
protected |
| string | $fileName | filename/path |
Definition at line 424 of file Graphics.php.
| optimizeImage | ( | $filename | ) |
| string | $file | name of file to optimize |
Definition at line 375 of file Graphics.php.
|
protected |
| render | ( | $input, | |
| $output = null ) |
Starts actions, saves image, calls bypass if necessary.
| string | $input | input filename |
| string | $output | output filename |
Reimplemented in Gd, Graphicsmagick, Imagemagick, and Imagick.
Definition at line 340 of file Graphics.php.
| renderFinished | ( | ) |
Resets ignore_user_abort
Definition at line 363 of file Graphics.php.
| setQuality | ( | $quality | ) |
Definition at line 476 of file Graphics.php.
|
protected |
Definition at line 407 of file Graphics.php.
|
static |
Looks for path to binary in system.
| string | $binary | filename of binary to look for |
Definition at line 463 of file Graphics.php.
|
protected |
Definition at line 74 of file Graphics.php.
|
protected |
Definition at line 102 of file Graphics.php.
|
protected |
Definition at line 54 of file Graphics.php.
|
protected |
Definition at line 46 of file Graphics.php.
|
protected |
Definition at line 94 of file Graphics.php.
|
protected |
Definition at line 90 of file Graphics.php.
|
protected |
Definition at line 82 of file Graphics.php.
|
protected |
Definition at line 86 of file Graphics.php.
|
protected |
Definition at line 62 of file Graphics.php.
|
protected |
Definition at line 50 of file Graphics.php.
|
protected |
Definition at line 98 of file Graphics.php.
|
protected |
Definition at line 58 of file Graphics.php.
|
protected |
Definition at line 78 of file Graphics.php.
|
protected |
Definition at line 66 of file Graphics.php.
|
protected |
Definition at line 70 of file Graphics.php.