YaWK
24.1
Yet another WebKit
|
Public Member Functions | |
__construct (string $image='', array $flags=[]) | |
__destruct () | |
arc (int $x, int $y, int $width, int $height, int $start, int $end, string|array $color, int|string $thickness=1) | |
autoOrient () | |
bestFit (int $maxWidth, int $maxHeight) | |
blur (string $type='selective', int $passes=1) | |
border (string|array $color, int $thickness=1) | |
brighten (int $percentage) | |
colorize (string|array $color) | |
contrast (int $percentage) | |
crop (int|float $x1, int|float $y1, int|float $x2, int|float $y2) | |
darken (int $percentage) | |
desaturate () | |
dot (int $x, int $y, string|array $color) | |
duotone (string|array $lightColor, string|array $darkColor) | |
edgeDetect () | |
ellipse (int $x, int $y, int $width, int $height, string|array $color, int|array $thickness=1) | |
emboss () | |
extractColors (int $count=5, string|array $backgroundColor=null) | |
fill (string|array $color) | |
fitToWidth (int $width) | |
flip (string $direction) | |
fromDataUri (string $uri) | |
fromFile (string $file) | |
fromNew (int $width, int $height, string|array $color='transparent') | |
fromString (string $string) | |
getAspectRatio () | |
getColorAt (int $x, int $y) | |
getExif () | |
getFlag (string $flag) | |
getHeight () | |
getMimeType () | |
getOrientation () | |
getResolution () | |
getWidth () | |
invert () | |
line (int $x1, int $y1, int $x2, int $y2, string|array $color, int $thickness=1) | |
maxColors (int $max, bool $dither=true) | |
opacity (float $opacity) | |
overlay (string|SimpleImage $overlay, string $anchor='center', float|int $opacity=1, int $xOffset=0, int $yOffset=0, bool $calculateOffsetFromEdge=false) | |
pixelate (int $size=10) | |
polygon (array $vertices, string|array $color, string|int|array $thickness=1) | |
rectangle (int $x1, int $y1, int $x2, int $y2, string|array $color, string|int|array $thickness=1) | |
resize (int $width=null, int $height=null) | |
resolution (int $res_x, int $res_y=null) | |
rotate (int $angle, string|array $backgroundColor='transparent') | |
roundedRectangle (int $x1, int $y1, int $x2, int $y2, int $radius, string|array $color, string|int|array $thickness=1) | |
sepia () | |
setFlag (string $flag, bool $value) | |
sharpen (int $amount=50) | |
sketch () | |
text (string $text, array $options, array &$boundary=null) | |
textBox (string $text, array $options) | |
thumbnail (int $width, int $height, string $anchor='center') | |
toDataUri (string $mimeType=null, array|int $options=100) | |
toDownload (string $filename, string $mimeType=null, array|int $options=100) | |
toFile (string $file, string $mimeType=null, array|int $options=100) | |
toScreen (string $mimeType=null, array|int $options=100) | |
toString (string $mimeType=null, array|int $options=100) | |
Static Public Member Functions | |
static | adjustColor (string|array $color, int $red, int $green, int $blue, int $alpha) |
static | darkenColor (string|array $color, int $amount) |
static | lightenColor (string|array $color, int $amount) |
static | normalizeColor (string|array $color) |
Public Attributes | |
const | ERR_FILE_NOT_FOUND = 1 |
const | ERR_FONT_FILE = 2 |
const | ERR_FREETYPE_NOT_ENABLED = 3 |
const | ERR_GD_NOT_ENABLED = 4 |
const | ERR_INVALID_COLOR = 5 |
const | ERR_INVALID_DATA_URI = 6 |
const | ERR_INVALID_FLAG = 12 |
const | ERR_INVALID_IMAGE = 7 |
const | ERR_LIB_NOT_LOADED = 8 |
const | ERR_UNSUPPORTED_FORMAT = 9 |
const | ERR_WEBP_NOT_ENABLED = 10 |
const | ERR_WRITE = 11 |
Protected Member Functions | |
allocateColor (string|array $color) | |
generate (string $mimeType=null, array|int $options=[]) | |
Static Protected Member Functions | |
static | imageCopyMergeAlpha ($dstIm, $srcIm, int $dstX, int $dstY, int $srcX, int $srcY, int $srcW, int $srcH, int $pct) |
static | keepWithin (int|float $value, int|float $min, int|float $max) |
Protected Attributes | |
null array false | $exif |
array | $flags |
$image | |
string | $mimeType |
Private Member Functions | |
excludeInsideColor (int $x, int $y, string|array $borderColor) | |
textSeparateLines (string $text, string $fontFile, int $fontSize, int $maxWidth) | |
textSeparateWords (string $text) | |
A PHP class that makes working with images as simple as possible.
Definition at line 27 of file SimpleImage.php.
YAWK\SimpleImage::__construct | ( | string | $image = '' , |
array | $flags = [] |
||
) |
Creates a new SimpleImage object.
string | $image | An image file or a data URI to load. |
array | $flags | Optional override of default flags. |
Exception | Thrown if the GD library is not found; file|URI or image data is invalid. |
Definition at line 85 of file SimpleImage.php.
References $value.
YAWK\SimpleImage::__destruct | ( | ) |
Destroys the image resource.
Definition at line 116 of file SimpleImage.php.
|
static |
Adjusts a color by increasing/decreasing red/green/blue/alpha values independently.
string | array | $color | The color to adjust. |
int | $red | Red adjustment (-255 - 255). |
int | $green | Green adjustment (-255 - 255). |
int | $blue | Blue adjustment (-255 - 255). |
int | $alpha | Alpha adjustment (-1 - 1). |
Exception |
Definition at line 2139 of file SimpleImage.php.
|
protected |
Converts a "friendly color" into a color identifier for use with GD's image functions.
string | array | $color | The color to allocate. |
Exception |
Definition at line 2100 of file SimpleImage.php.
YAWK\SimpleImage::arc | ( | int | $x, |
int | $y, | ||
int | $width, | ||
int | $height, | ||
int | $start, | ||
int | $end, | ||
string|array | $color, | ||
int|string | $thickness = 1 |
||
) |
Draws an arc.
int | $x | The x coordinate of the arc's center. |
int | $y | The y coordinate of the arc's center. |
int | $width | The width of the arc. |
int | $height | The height of the arc. |
int | $start | The start of the arc in degrees. |
int | $end | The end of the arc in degrees. |
string | array | $color | The arc color. |
int | string | $thickness | Line thickness in pixels or 'filled' (default 1). |
Exception |
Definition at line 1536 of file SimpleImage.php.
YAWK\SimpleImage::autoOrient | ( | ) |
Rotates an image so the orientation will be correct based on its exif data. It is safe to call this method on images that don't have exif data (no changes will be made).
Exception |
Definition at line 684 of file SimpleImage.php.
YAWK\SimpleImage::bestFit | ( | int | $maxWidth, |
int | $maxHeight | ||
) |
Proportionally resize the image to fit inside a specific width and height.
int | $maxWidth | The maximum width the image can be. |
int | $maxHeight | The maximum height the image can be. |
Definition at line 728 of file SimpleImage.php.
YAWK\SimpleImage::blur | ( | string | $type = 'selective' , |
int | $passes = 1 |
||
) |
Applies the blur filter.
string | $type | The blur algorithm to use: 'selective', 'gaussian' (default 'gaussian'). |
int | $passes | The number of time to apply the filter, enhancing the effect (default 1). |
Definition at line 1874 of file SimpleImage.php.
YAWK\SimpleImage::border | ( | string|array | $color, |
int | $thickness = 1 |
||
) |
Draws a border around the image.
string | array | $color | The border color. |
int | $thickness | The thickness of the border (default 1). |
Exception |
Definition at line 1580 of file SimpleImage.php.
YAWK\SimpleImage::brighten | ( | int | $percentage | ) |
Applies the brightness filter to brighten the image.
int | $percentage | Percentage to brighten the image (0 - 100). |
Definition at line 1891 of file SimpleImage.php.
YAWK\SimpleImage::colorize | ( | string|array | $color | ) |
Applies the colorize filter.
string | array | $color | The filter color. |
Exception |
Definition at line 1908 of file SimpleImage.php.
YAWK\SimpleImage::contrast | ( | int | $percentage | ) |
Applies the contrast filter.
int | $percentage | Percentage to adjust (-100 - 100). |
Definition at line 1930 of file SimpleImage.php.
YAWK\SimpleImage::crop | ( | int|float | $x1, |
int|float | $y1, | ||
int|float | $x2, | ||
int|float | $y2 | ||
) |
Crop the image.
int | float | $x1 | Top left x coordinate. |
int | float | $y1 | Top left y coordinate. |
int | float | $x2 | Bottom right x coordinate. |
int | float | $y2 | Bottom right x coordinate. |
Definition at line 768 of file SimpleImage.php.
YAWK\SimpleImage::darken | ( | int | $percentage | ) |
Applies the brightness filter to darken the image.
int | $percentage | Percentage to darken the image (0 - 100). |
Definition at line 1943 of file SimpleImage.php.
|
static |
Darkens a color.
string | array | $color | The color to darken. |
int | $amount | Amount to darken (0 - 255). |
Exception |
Definition at line 2162 of file SimpleImage.php.
YAWK\SimpleImage::desaturate | ( | ) |
Applies the desaturate (grayscale) filter.
Definition at line 1957 of file SimpleImage.php.
YAWK\SimpleImage::dot | ( | int | $x, |
int | $y, | ||
string|array | $color | ||
) |
Draws a single pixel dot.
int | $x | The x coordinate of the dot. |
int | $y | The y coordinate of the dot. |
string | array | $color | The dot color. |
Exception |
Definition at line 1604 of file SimpleImage.php.
YAWK\SimpleImage::duotone | ( | string|array | $lightColor, |
string|array | $darkColor | ||
) |
Applies a duotone filter to the image.
string | array | $lightColor | The lightest color in the duotone. |
string | array | $darkColor | The darkest color in the duotone. |
Exception |
Definition at line 813 of file SimpleImage.php.
References $i.
YAWK\SimpleImage::edgeDetect | ( | ) |
YAWK\SimpleImage::ellipse | ( | int | $x, |
int | $y, | ||
int | $width, | ||
int | $height, | ||
string|array | $color, | ||
int|array | $thickness = 1 |
||
) |
Draws an ellipse.
int | $x | The x coordinate of the center. |
int | $y | The y coordinate of the center. |
int | $width | The ellipse width. |
int | $height | The ellipse height. |
string | array | $color | The ellipse color. |
int | array | $thickness | Line thickness in pixels or 'filled' (default 1). |
Exception |
Definition at line 1625 of file SimpleImage.php.
YAWK\SimpleImage::emboss | ( | ) |
|
private |
Exclude inside color. Used for roundedRectangle(), ellipse() and arc()
int | $x | certer x of rectangle. |
int | $y | certer y of rectangle. |
string | array | $borderColor | The color of border. |
Exception |
Definition at line 1854 of file SimpleImage.php.
YAWK\SimpleImage::extractColors | ( | int | $count = 5 , |
string|array | $backgroundColor = null |
||
) |
Extracts colors from an image like a human would do.â„¢ This method requires the third-party library \League\ColorExtractor. If you're using Composer, it will be installed for you automatically.
int | $count | The max number of colors to extract (default 5). |
string | array | null | $backgroundColor | By default any pixel with alpha value greater than zero will be discarded. This is because transparent colors are not perceived as is. For example, fully transparent black would be seen white on a white background. So if you want to take transparency into account, you have to specify a default background color. |
Exception | Thrown if library \League\ColorExtractor is missing. |
Definition at line 2182 of file SimpleImage.php.
References $value.
YAWK\SimpleImage::fill | ( | string|array | $color | ) |
Fills the image with a solid color.
string | array | $color | The fill color. |
Exception |
Definition at line 1668 of file SimpleImage.php.
YAWK\SimpleImage::fitToWidth | ( | int | $width | ) |
Proportionally resize the image to a specific width.
int | $width | The width to resize the image to. |
resize(null, $height)
instead. Definition at line 858 of file SimpleImage.php.
YAWK\SimpleImage::flip | ( | string | $direction | ) |
Flip the image horizontally or vertically.
string | $direction | The direction to flip: x|y|both. |
Definition at line 869 of file SimpleImage.php.
YAWK\SimpleImage::fromDataUri | ( | string | $uri | ) |
Loads an image from a data URI.
string | $uri | A data URI. |
Exception | Thrown if URI or image data is invalid. |
Definition at line 171 of file SimpleImage.php.
YAWK\SimpleImage::fromFile | ( | string | $file | ) |
Loads an image from a file.
string | $file | The image file to load. |
Exception | Thrown if file or image data is invalid. |
Definition at line 206 of file SimpleImage.php.
YAWK\SimpleImage::fromNew | ( | int | $width, |
int | $height, | ||
string|array | $color = 'transparent' |
||
) |
Creates a new image.
int | $width | The width of the image. |
int | $height | The height of the image. |
string | array | $color | Optional fill color for the new image (default 'transparent'). |
Exception |
Definition at line 276 of file SimpleImage.php.
YAWK\SimpleImage::fromString | ( | string | $string | ) |
Definition at line 300 of file SimpleImage.php.
|
protected |
Generates an image.
string | null | $mimeType | The image format to output as a mime type (defaults to the original mime type). |
array | int | $options | Array or Image quality as a percentage (default 100). |
Exception | Thrown when WEBP support is not enabled or unsupported format. |
Definition at line 318 of file SimpleImage.php.
YAWK\SimpleImage::getAspectRatio | ( | ) |
Gets the image's current aspect ratio.
Definition at line 576 of file SimpleImage.php.
YAWK\SimpleImage::getColorAt | ( | int | $x, |
int | $y | ||
) |
Gets the RGBA value of a single pixel.
int | $x | The horizontal position of the pixel. |
int | $y | The vertical position of the pixel. |
Definition at line 2222 of file SimpleImage.php.
YAWK\SimpleImage::getExif | ( | ) |
Gets the image's exif data.
Definition at line 586 of file SimpleImage.php.
YAWK\SimpleImage::getFlag | ( | string | $flag | ) |
Get flag value.
string | $flag | Name of the flag to get. |
Definition at line 154 of file SimpleImage.php.
YAWK\SimpleImage::getHeight | ( | ) |
Gets the image's current height.
Definition at line 594 of file SimpleImage.php.
Referenced by YAWK\SimpleImage\overlay().
YAWK\SimpleImage::getMimeType | ( | ) |
Gets the mime type of the loaded image.
Definition at line 602 of file SimpleImage.php.
YAWK\SimpleImage::getOrientation | ( | ) |
Gets the image's current orientation.
Definition at line 612 of file SimpleImage.php.
YAWK\SimpleImage::getResolution | ( | ) |
Gets the resolution of the image
Definition at line 632 of file SimpleImage.php.
YAWK\SimpleImage::getWidth | ( | ) |
Gets the image's current width.
Definition at line 640 of file SimpleImage.php.
Referenced by YAWK\SimpleImage\overlay().
|
staticprotected |
Same as PHP's imagecopymerge, but works with transparent images. Used internally for overlay.
resource | $dstIm | Destination image link resource. |
resource | $srcIm | Source image link resource. |
int | $dstX | x-coordinate of destination point. |
int | $dstY | y-coordinate of destination point. |
int | $srcX | x-coordinate of source point. |
int | $srcY | y-coordinate of source point. |
int | $srcW | Source width. |
int | $srcH | Source height. |
Definition at line 662 of file SimpleImage.php.
YAWK\SimpleImage::invert | ( | ) |
|
staticprotected |
Ensures a numeric value is always within the min and max range.
int | float | $value | A numeric value to test. |
int | float | $min | The minimum allowed value. |
int | float | $max | The maximum allowed value. |
Definition at line 559 of file SimpleImage.php.
References $value.
|
static |
Lightens a color.
string | array | $color | The color to lighten. |
int | $amount | Amount to lighten (0 - 255). |
Exception |
Definition at line 2246 of file SimpleImage.php.
YAWK\SimpleImage::line | ( | int | $x1, |
int | $y1, | ||
int | $x2, | ||
int | $y2, | ||
string|array | $color, | ||
int | $thickness = 1 |
||
) |
Draws a line.
int | $x1 | The x coordinate for the first point. |
int | $y1 | The y coordinate for the first point. |
int | $x2 | The x coordinate for the second point. |
int | $y2 | The y coordinate for the second point. |
string | array | $color | The line color. |
int | $thickness | The line thickness (default 1). |
Exception |
Definition at line 1693 of file SimpleImage.php.
YAWK\SimpleImage::maxColors | ( | int | $max, |
bool | $dither = true |
||
) |
Reduces the image to a maximum number of colors.
int | $max | The maximum number of colors to use. |
bool | $dither | Whether or not to use a dithering effect (default true). |
Definition at line 888 of file SimpleImage.php.
|
static |
Normalizes a hex or array color value to a well-formatted RGBA array.
string | array | $color | A CSS color name, hex string, or an array [red, green, blue, alpha]. You can pipe alpha transparency through hex strings and color names. For example: #fff|0.50 <– 50% white red|0.25 <– 25% red |
Exception | Thrown if color value is invalid. |
Definition at line 2263 of file SimpleImage.php.
YAWK\SimpleImage::opacity | ( | float | $opacity | ) |
Changes the image's opacity level.
float | $opacity | The desired opacity level (0 - 1). |
Exception |
Definition at line 2008 of file SimpleImage.php.
YAWK\SimpleImage::overlay | ( | string|SimpleImage | $overlay, |
string | $anchor = 'center' , |
||
float|int | $opacity = 1 , |
||
int | $xOffset = 0 , |
||
int | $yOffset = 0 , |
||
bool | $calculateOffsetFromEdge = false |
||
) |
Place an image on top of the current image.
string | SimpleImage | $overlay | The image to overlay. This can be a filename, a data URI, or a SimpleImage object. |
string | $anchor | The anchor point: 'center', 'top', 'bottom', 'left', 'right', 'top left', 'top right', 'bottom left', 'bottom right' (default 'center'). |
float | int | $opacity | The opacity level of the overlay 0-1 (default 1). |
int | $xOffset | Horizontal offset in pixels (default 0). |
int | $yOffset | Vertical offset in pixels (default 0). |
bool | $calculateOffsetFromEdge | Calculate Offset referring to the edges of the image (default false). |
Exception |
Definition at line 908 of file SimpleImage.php.
References YAWK\SimpleImage\getHeight(), and YAWK\SimpleImage\getWidth().
YAWK\SimpleImage::pixelate | ( | int | $size = 10 | ) |
Applies the pixelate filter.
int | $size | The size of the blocks in pixels (default 10). |
Definition at line 2034 of file SimpleImage.php.
YAWK\SimpleImage::polygon | ( | array | $vertices, |
string|array | $color, | ||
string|int|array | $thickness = 1 |
||
) |
Draws a polygon.
array | $vertices | The polygon's vertices in an array of x/y arrays. Example: [ ['x' => x1, 'y' => y1], ['x' => x2, 'y' => y2], ['x' => xN, 'y' => yN] ] |
string | array | $color | The polygon color. |
string | int | array | $thickness | Line thickness in pixels or 'filled' (default 1). |
Exception |
Definition at line 1722 of file SimpleImage.php.
YAWK\SimpleImage::rectangle | ( | int | $x1, |
int | $y1, | ||
int | $x2, | ||
int | $y2, | ||
string|array | $color, | ||
string|int|array | $thickness = 1 |
||
) |
Draws a rectangle.
int | $x1 | The upper left x coordinate. |
int | $y1 | The upper left y coordinate. |
int | $x2 | The bottom right x coordinate. |
int | $y2 | The bottom right y coordinate. |
string | array | $color | The rectangle color. |
string | int | array | $thickness | Line thickness in pixels or 'filled' (default 1). |
Exception |
Definition at line 1759 of file SimpleImage.php.
YAWK\SimpleImage::resize | ( | int | $width = null , |
int | $height = null |
||
) |
Resize an image to the specified dimensions. If only one dimension is specified, the image will be resized proportionally.
int | null | $width | The new image width. |
int | null | $height | The new image height. |
Definition at line 961 of file SimpleImage.php.
YAWK\SimpleImage::resolution | ( | int | $res_x, |
int | $res_y = null |
||
) |
Sets an image's resolution, as per https://www.php.net/manual/en/function.imageresolution.php
int | $res_x | The horizontal resolution in DPI. |
int | null | $res_y | The vertical resolution in DPI |
Definition at line 1013 of file SimpleImage.php.
YAWK\SimpleImage::rotate | ( | int | $angle, |
string|array | $backgroundColor = 'transparent' |
||
) |
Rotates the image.
int | $angle | The angle of rotation (-360 - 360). |
string | array | $backgroundColor | The background color to use for the uncovered zone area after rotation (default 'transparent'). |
Exception |
Definition at line 1033 of file SimpleImage.php.
YAWK\SimpleImage::roundedRectangle | ( | int | $x1, |
int | $y1, | ||
int | $x2, | ||
int | $y2, | ||
int | $radius, | ||
string|array | $color, | ||
string|int|array | $thickness = 1 |
||
) |
Draws a rounded rectangle.
int | $x1 | The upper left x coordinate. |
int | $y1 | The upper left y coordinate. |
int | $x2 | The bottom right x coordinate. |
int | $y2 | The bottom right y coordinate. |
int | $radius | The border radius in pixels. |
string | array | $color | The rectangle color. |
string | int | array | $thickness | Line thickness in pixels or 'filled' (default 1). |
Exception |
Definition at line 1790 of file SimpleImage.php.
YAWK\SimpleImage::sepia | ( | ) |
Simulates a sepia effect by desaturating the image and applying a sepia tone.
Definition at line 2046 of file SimpleImage.php.
YAWK\SimpleImage::setFlag | ( | string | $flag, |
bool | $value | ||
) |
Set flag value.
string | $flag | Name of the flag to set. |
bool | $value | State of the flag. |
Exception | Thrown if flag does not exist (no default value). |
Definition at line 138 of file SimpleImage.php.
References $value.
YAWK\SimpleImage::sharpen | ( | int | $amount = 50 | ) |
Sharpens the image.
int | $amount | Sharpening amount (default 50). |
Definition at line 2060 of file SimpleImage.php.
YAWK\SimpleImage::sketch | ( | ) |
Applies the mean remove filter to produce a sketch effect.
Definition at line 2082 of file SimpleImage.php.
YAWK\SimpleImage::text | ( | string | $text, |
array | $options, | ||
array & | $boundary = null |
||
) |
Adds text to the image.
string | $text | The desired text. |
array | $options | An array of options.
|
array | null | $boundary | If passed, this variable will contain an array with coordinates that surround the text: [x1, y1, x2, y2, width, height]. This can be used for calculating the text's position after it gets added to the image. |
Exception |
Definition at line 1073 of file SimpleImage.php.
References $options.
YAWK\SimpleImage::textBox | ( | string | $text, |
array | $options | ||
) |
Adds text with a line break to the image.
string | $text | The desired text. |
array | $options | An array of options.
|
Exception |
Definition at line 1260 of file SimpleImage.php.
References $options.
|
private |
Receives a text and breaks into LINES.
Definition at line 1379 of file SimpleImage.php.
References $i.
|
private |
Receives a text and breaks into WORD / SPACE / NEW LINE.
Definition at line 1420 of file SimpleImage.php.
YAWK\SimpleImage::thumbnail | ( | int | $width, |
int | $height, | ||
string | $anchor = 'center' |
||
) |
Creates a thumbnail image. This function attempts to get the image as close to the provided dimensions as possible, then crops the remaining overflow to force the desired size. Useful for generating thumbnail images.
int | $width | The thumbnail width. |
int | $height | The thumbnail height. |
string | $anchor | The anchor point: 'center', 'top', 'bottom', 'left', 'right', 'top left', 'top right', 'bottom left', 'bottom right' (default 'center'). |
Definition at line 1443 of file SimpleImage.php.
YAWK\SimpleImage::toDataUri | ( | string | $mimeType = null , |
array|int | $options = 100 |
||
) |
Generates a data URI.
string | null | $mimeType | The image format to output as a mime type (defaults to the original mime type). |
array | int | $options | Array or Image quality as a percentage (default 100). |
Exception |
Definition at line 460 of file SimpleImage.php.
References $options.
YAWK\SimpleImage::toDownload | ( | string | $filename, |
string | $mimeType = null , |
||
array|int | $options = 100 |
||
) |
Forces the image to be downloaded to the clients machine. Must be called before any output is sent to the screen.
string | $filename | The filename (without path) to send to the client (e.g. 'image.jpeg'). |
string | null | $mimeType | The image format to output as a mime type (defaults to the original mime type). |
array | int | $options | Array or Image quality as a percentage (default 100). |
Exception |
Definition at line 477 of file SimpleImage.php.
References $options.
YAWK\SimpleImage::toFile | ( | string | $file, |
string | $mimeType = null , |
||
array|int | $options = 100 |
||
) |
Writes the image to a file.
string | $file | The image format to output as a mime type (defaults to the original mime type). |
string | null | $mimeType | Image quality as a percentage (default 100). |
array | int | $options | Array or Image quality as a percentage (default 100). |
Exception | Thrown if failed write to file. |
Definition at line 504 of file SimpleImage.php.
References $options.
YAWK\SimpleImage::toScreen | ( | string | $mimeType = null , |
array|int | $options = 100 |
||
) |
Outputs the image to the screen. Must be called before any output is sent to the screen.
string | null | $mimeType | The image format to output as a mime type (defaults to the original mime type). |
array | int | $options | Array or Image quality as a percentage (default 100). |
Exception |
Definition at line 525 of file SimpleImage.php.
References $options.
YAWK\SimpleImage::toString | ( | string | $mimeType = null , |
array|int | $options = 100 |
||
) |
Generates an image string.
string | null | $mimeType | The image format to output as a mime type (defaults to the original mime type). |
array | int | $options | Array or Image quality as a percentage (default 100). |
Exception |
Definition at line 544 of file SimpleImage.php.
References $options.
|
protected |
Definition at line 71 of file SimpleImage.php.
|
protected |
Definition at line 65 of file SimpleImage.php.
|
protected |
Definition at line 67 of file SimpleImage.php.
|
protected |
Definition at line 69 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_FILE_NOT_FOUND = 1 |
Definition at line 30 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_FONT_FILE = 2 |
Definition at line 33 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_FREETYPE_NOT_ENABLED = 3 |
Definition at line 36 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_GD_NOT_ENABLED = 4 |
Definition at line 39 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_INVALID_COLOR = 5 |
Definition at line 42 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_INVALID_DATA_URI = 6 |
Definition at line 45 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_INVALID_FLAG = 12 |
Definition at line 63 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_INVALID_IMAGE = 7 |
Definition at line 48 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_LIB_NOT_LOADED = 8 |
Definition at line 51 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_UNSUPPORTED_FORMAT = 9 |
Definition at line 54 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_WEBP_NOT_ENABLED = 10 |
Definition at line 57 of file SimpleImage.php.
const YAWK\SimpleImage::ERR_WRITE = 11 |
Definition at line 60 of file SimpleImage.php.