PHP Class Tollwerk\Squeezr\Image

Since: 1.0b
Author: Joschi Kuphal ([email protected])
Inheritance: extends Tollwerk\Squeezr
显示文件 Open project: jkphl/squeezr Class Usage Examples

Protected Properties

Property Type Description
$_absoluteCacheImageDir string Parent directory of cached image file (absolute path)
$_absoluteCacheImagePath string Cached image file (absolute path)
$_absoluteImagePath string Requested image file (absolute path)
$_quantizers array Valid quantizers
$_relativeImagePath string Requested image file (relative path to document root)

Public Methods

Method Description
instance ( string $image ) : Image Instanciate an image adaptor
send ( ) : void Send the cached and possibly downsampled image
squeeze ( string $source, string $target, string $breakpoint = SQUEEZR_BREAKPOINT, array &$errors = [] ) : string Squeeze a particular source file

Protected Methods

Method Description
__construct ( string $image ) Constructor
_downscaleGif ( string $source, integer $width, integer $height, string $target, integer $targetWidth, integer $targetHeight ) : boolean Downscale a GIF image
_downscaleJpeg ( string $source, integer $width, integer $height, string $target, integer $targetWidth, integer $targetHeight ) : boolean Downscale a JPEG image
_downscalePng ( string $source, integer $width, integer $height, string $target, integer $targetWidth, integer $targetHeight ) : boolean Downscale a PNG image
_enableTranparency ( resource $image, array $transparentColor = null ) : void Enable transparency on an image resource
_sharpenImage ( resource $image, integer $width, integer $targetWidth ) : void Sharpen an image

Method Details

__construct() protected method

Constructor
protected __construct ( string $image )
$image string Image file

_downscaleGif() protected static method

Downscale a GIF image
protected static _downscaleGif ( string $source, integer $width, integer $height, string $target, integer $targetWidth, integer $targetHeight ) : boolean
$source string Source image path
$width integer Source image width
$height integer Source image height
$target string Target image path
$targetWidth integer Target image width
$targetHeight integer Target image height
return boolean Downscaled image has been saved

_downscaleJpeg() protected static method

Downscale a JPEG image
protected static _downscaleJpeg ( string $source, integer $width, integer $height, string $target, integer $targetWidth, integer $targetHeight ) : boolean
$source string Source image path
$width integer Source image width
$height integer Source image height
$target string Target image path
$targetWidth integer Target image width
$targetHeight integer Target image height
return boolean Downscaled image has been saved

_downscalePng() protected static method

Downscale a PNG image
protected static _downscalePng ( string $source, integer $width, integer $height, string $target, integer $targetWidth, integer $targetHeight ) : boolean
$source string Source image path
$width integer Source image width
$height integer Source image height
$target string Target image path
$targetWidth integer Target image width
$targetHeight integer Target image height
return boolean Downscaled image has been saved

_enableTranparency() protected static method

Enable transparency on an image resource
protected static _enableTranparency ( resource $image, array $transparentColor = null ) : void
$image resource Image resource
$transparentColor array Transparent color
return void

_sharpenImage() protected static method

Sharpen an image
protected static _sharpenImage ( resource $image, integer $width, integer $targetWidth ) : void
$image resource Image resource
$width integer Original image width
$targetWidth integer Downsampled image width
return void

instance() public static method

Instanciate an image adaptor
public static instance ( string $image ) : Image
$image string Image file
return Image Instance reference

send() public method

Send the cached and possibly downsampled image
public send ( ) : void
return void

squeeze() public static method

Squeeze a particular source file
public static squeeze ( string $source, string $target, string $breakpoint = SQUEEZR_BREAKPOINT, array &$errors = [] ) : string
$source string Source file
$target string Target file
$breakpoint string Breakpoint
$errors array Errors
return string Result file path

Property Details

$_absoluteCacheImageDir protected_oe property

Parent directory of cached image file (absolute path)
protected string $_absoluteCacheImageDir
return string

$_absoluteCacheImagePath protected_oe property

Cached image file (absolute path)
protected string $_absoluteCacheImagePath
return string

$_absoluteImagePath protected_oe property

Requested image file (absolute path)
protected string $_absoluteImagePath
return string

$_quantizers protected_oe static_oe property

Valid quantizers
protected static array $_quantizers
return array

$_relativeImagePath protected_oe property

Requested image file (relative path to document root)
protected string $_relativeImagePath
return string