PHP 클래스 Craft\ImagerVariable

파일 보기 프로젝트 열기: aelvan/Imager-Craft

공개 메소드들

메소드 설명
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