PHP Class Craft\ImagerVariable

Datei anzeigen Open project: aelvan/Imager-Craft

Public Methods

Method Description
base64Pixel ( $width = 1, $height = 1 ) : string Returns a base64 encoded transparent pixel. Useful for adding as src on img tags for validation when using srcset.
clientSupportsWebp ( ) : boolean Checks for webp support in browser
getColorPalette ( $image, integer $colorCount = 8, integer $quality = 10, string $colorValue = 'hex' ) : mixed Gets a palette of colors from an image
getDominantColor ( $image, integer $quality = 10, string $colorValue = 'hex' ) : mixed Gets the dominant color of an image
hex2rgb ( string $color ) : array Converts a hex color value to rgb
rgb2hex ( array $color ) : string Converts a rgb color value to hex
serverSupportsWebp ( ) : boolean Checks for webp support in image driver
srcset ( Array $images, string $descriptor = 'w' ) : string Takes an array of Imager_ImageModel (or anything else that supports getUrl() and getWidth()) and returns a srcset string
transformImage ( $file, $transform, $transformDefaults = null, $configOverrides = null ) : mixed Transforms an image

Method Details

base64Pixel() public method

Returns a base64 encoded transparent pixel. Useful for adding as src on img tags for validation when using srcset.
public base64Pixel ( $width = 1, $height = 1 ) : string
return string

clientSupportsWebp() public method

Checks for webp support in browser
public clientSupportsWebp ( ) : boolean
return boolean

getColorPalette() public method

Gets a palette of colors from an image
public getColorPalette ( $image, integer $colorCount = 8, integer $quality = 10, string $colorValue = 'hex' ) : mixed
$image
$colorCount integer
$quality integer
$colorValue string
return mixed

getDominantColor() public method

Gets the dominant color of an image
public getDominantColor ( $image, integer $quality = 10, string $colorValue = 'hex' ) : mixed
$image
$quality integer
$colorValue string
return mixed

hex2rgb() public method

Converts a hex color value to rgb
public hex2rgb ( string $color ) : array
$color string
return array

rgb2hex() public method

Converts a rgb color value to hex
public rgb2hex ( array $color ) : string
$color array
return string

serverSupportsWebp() public method

Checks for webp support in image driver
public serverSupportsWebp ( ) : boolean
return boolean

srcset() public method

todo : Implement support for other descriptors
public srcset ( Array $images, string $descriptor = 'w' ) : string
$images Array
$descriptor string
return string

transformImage() public method

Transforms an image
public transformImage ( $file, $transform, $transformDefaults = null, $configOverrides = null ) : mixed
$file
$transform
$configOverrides
return mixed