Метод | Описание | |
---|---|---|
apply ( |
Apply a filter to the image. See Filters section for a list of available filters. | |
blend ( |
Blend two images together with the first image as the base and the second image on top. Supports several blend modes. | |
compare ( Grafika\ImageInterface | string $image1, Grafika\ImageInterface | string $image2 ) : integer | Compare two images and returns a hamming distance. A value of 0 indicates a likely similar picture. A value between 1 and 10 is potentially a variation. A value greater than 10 is likely a different image. | |
crop ( |
Crop the image to the given dimension and position. | |
draw ( |
Draw a DrawingObject on the image. See Drawing Objects section. | |
equal ( string | Grafika\ImageInterface $image1, string | Grafika\ImageInterface $image2 ) : boolean | Compare if two images are equal. It will compare if the two images are of the same width and height. If the dimensions differ, it will return false. If the dimensions are equal, it will loop through each pixels. If one of the pixel don't match, it will return false. The pixels are compared using their RGB (Red, Green, Blue) values. | |
fill ( |
Fill entire image with color. | |
flatten ( |
Flatten if animated GIF. Do nothing otherwise. | |
flip ( |
Flip or mirrors the image. | |
free ( |
Free the image clearing resources associated with it. | |
gdAlpha ( float $alpha ) : integer | Convert alpha value of 0 - 1 to GD compatible alpha value of 0 - 127 where 0 is opaque and 127 is transparent | |
isAvailable ( ) : boolean | Checks if the editor is available on the current PHP install. | |
opacity ( |
Sets the image to the specified opacity level where 1.0 is fully opaque and 0.0 is fully transparent. | |
open ( |
Open an image file and assign Image to first parameter. | |
resize ( |
Wrapper function for the resizeXXX family of functions. Resize image given width, height and mode. | |
resizeExact ( |
Resize image to exact dimensions ignoring aspect ratio. Useful if you want to force exact width and height. | |
resizeExactHeight ( |
Resize image to exact height. Width is auto calculated. Useful for creating row of images with the same height. | |
resizeExactWidth ( |
Resize image to exact width. Height is auto calculated. Useful for creating column of images with the same width. | |
resizeFill ( |
Resize image to fill all the space in the given dimension. Excess parts are cropped. | |
resizeFit ( |
Resize image to fit inside the given dimension. No part of the image is lost. | |
rotate ( |
Rotate an image counter-clockwise. | |
save ( |
Save the image to an image format. | |
text ( |
Write text to image. |
Метод | Описание | |
---|---|---|
_blendMultiply ( $canvas, $gd1, $gd2, $loopStartY, $loopEndY, $loopStartX, $loopEndX, $offsetX, $offsetY, $opacity ) | ||
_blendOverlay ( $canvas, $gd1, $gd2, $loopStartY, $loopEndY, $loopStartX, $loopEndX, $offsetX, $offsetY, $opacity ) | ||
_blendScreen ( $canvas, $gd1, $gd2, $loopStartY, $loopEndY, $loopStartX, $loopEndX, $offsetX, $offsetY, $opacity ) | ||
_entropy ( $hist ) : float | integer | Calculate entropy based on histogram. | |
_flip ( |
Flips image. | |
_getImageTypeFromFileName ( integer $imageFile ) : |
Get image type base on file extension. | |
_resize ( |
Resize helper function. | |
_smartCrop ( |
Crop based on entropy. |
public apply ( |
||
$image | ||
$filter | Grafika\FilterInterface | |
Результат |
public blend ( |
||
$image1 | The base image. | |
$image2 | The image placed on top of the base image. | |
$type | string | The blend mode. Can be: normal, multiply, overlay or screen. |
$opacity | float | The opacity of $image2. Possible values 0.0 to 1.0 where 0.0 is fully transparent and 1.0 is fully opaque. Defaults to 1.0. |
$position | string | The position of $image2 on $image1. Possible values top-left, top-center, top-right, center-left, center, center-right, bottom-left, bottom-center, bottom-right and smart. Defaults to top-left. |
$offsetX | integer | Number of pixels to add to the X position of $image2. |
$offsetY | integer | Number of pixels to add to the Y position of $image2. |
Результат |
public compare ( Grafika\ImageInterface | string $image1, Grafika\ImageInterface | string $image2 ) : integer | ||
$image1 | Grafika\ImageInterface | string | |
$image2 | Grafika\ImageInterface | string | |
Результат | integer | Hamming distance. Note: This breaks the chain if you are doing fluent api calls as it does not return an Editor. |
public crop ( |
||
$image | ||
$cropWidth | integer | Crop width in pixels. |
$cropHeight | integer | Crop Height in pixels. |
$position | string | The crop position. Possible values top-left, top-center, top-right, center-left, center, center-right, bottom-left, bottom-center, bottom-right and smart. Defaults to center. |
$offsetX | integer | Number of pixels to add to the X position of the crop. |
$offsetY | integer | Number of pixels to add to the Y position of the crop. |
Результат |
public draw ( |
||
$image | ||
$drawingObject | Grafika\DrawingObjectInterface |
public equal ( string | Grafika\ImageInterface $image1, string | Grafika\ImageInterface $image2 ) : boolean | ||
$image1 | string | Grafika\ImageInterface | Can be an instance of Image or string containing the file system path to image. |
$image2 | string | Grafika\ImageInterface | Can be an instance of Image or string containing the file system path to image. |
Результат | boolean | True if equals false if not. Note: This breaks the chain if you are doing fluent api calls as it does not return an Editor. |
public flatten ( |
||
$image | ||
Результат |
public free ( |
||
$image | ||
Результат |
public isAvailable ( ) : boolean | ||
Результат | boolean | True if available false if not. |
public resizeExact ( |
||
$image | ||
$newWidth | integer | Width in pixels. |
$newHeight | integer | Height in pixels. |
Результат |
public resizeExactHeight ( |
||
$image | ||
$newHeight | integer | Height in pixels. |
Результат |
public resizeExactWidth ( |
||
$image | ||
$newWidth | integer | Width in pixels. |
Результат |
public resizeFill ( |
||
$image | ||
$newWidth | integer | Width in pixels. |
$newHeight | integer | Height in pixels. |
Результат |
public save ( |
||
$image | ||
$file | string | File path where to save the image. |
$type | null | string | Type of image. Can be null, "GIF", "PNG", or "JPEG". |
$quality | null | string | Quality of image. Applies to JPEG only. Accepts number 0 - 100 where 0 is lowest and 100 is the highest quality. Or null for default. |
$interlace | boolean | false | Set to true for progressive JPEG. Applies to JPEG only. |
$permission | integer | Default permission when creating non-existing target directory. |
Результат |
public text ( |
||
$image | ||
$text | string | The text to be written. |
$size | integer | The font size. Defaults to 12. |
$x | integer | The distance from the left edge of the image to the left of the text. Defaults to 0. |
$y | integer | The distance from the top edge of the image to the top of the text. Defaults to 12 (equal to font size) so that the text is placed within the image. |
$color | The Color object. Default text color is black. | |
$font | string | Full path to font file. If blank, will default to Liberation Sans font. |
$angle | integer | Angle of text from 0 - 359. Defaults to 0. |
Результат | Grafika\EditorInterface |