PHP Класс Craft\ImagerVariable

Показать файл Открыть проект

Открытые методы

Метод Описание
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

Описание методов

base64Pixel() публичный Метод

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
Результат string

clientSupportsWebp() публичный Метод

Checks for webp support in browser
public clientSupportsWebp ( ) : boolean
Результат boolean

getColorPalette() публичный Метод

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
Результат mixed

getDominantColor() публичный Метод

Gets the dominant color of an image
public getDominantColor ( $image, integer $quality = 10, string $colorValue = 'hex' ) : mixed
$image
$quality integer
$colorValue string
Результат mixed

hex2rgb() публичный Метод

Converts a hex color value to rgb
public hex2rgb ( string $color ) : array
$color string
Результат array

rgb2hex() публичный Метод

Converts a rgb color value to hex
public rgb2hex ( array $color ) : string
$color array
Результат string

serverSupportsWebp() публичный Метод

Checks for webp support in image driver
public serverSupportsWebp ( ) : boolean
Результат boolean

srcset() публичный Метод

todo : Implement support for other descriptors
public srcset ( Array $images, string $descriptor = 'w' ) : string
$images Array
$descriptor string
Результат string

transformImage() публичный Метод

Transforms an image
public transformImage ( $file, $transform, $transformDefaults = null, $configOverrides = null ) : mixed
$file
$transform
$configOverrides
Результат mixed