PHP Class Craft\ImagerVariable

Afficher le fichier Open project: aelvan/Imager-Craft

Méthodes publiques

Méthode 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 méthode

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
Résultat string

clientSupportsWebp() public méthode

Checks for webp support in browser
public clientSupportsWebp ( ) : boolean
Résultat boolean

getColorPalette() public méthode

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
Résultat mixed

getDominantColor() public méthode

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

hex2rgb() public méthode

Converts a hex color value to rgb
public hex2rgb ( string $color ) : array
$color string
Résultat array

rgb2hex() public méthode

Converts a rgb color value to hex
public rgb2hex ( array $color ) : string
$color array
Résultat string

serverSupportsWebp() public méthode

Checks for webp support in image driver
public serverSupportsWebp ( ) : boolean
Résultat boolean

srcset() public méthode

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

transformImage() public méthode

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