PHP Class Gc\Media\Image

Datei anzeigen Open project: gotcms/gotcms Class Usage Examples

Protected Properties

Property Type Description
$availableOptions array Available options
$height integer Original image height
$image resource Original image
$imageResized resource Image resized
$width integer Original image width

Public Methods

Method Description
__construct ( string $filename = null ) Initialize object
hex2rgb ( string $hexString ) : resource Convert hexa string to rbg
open ( string $file ) : Image Open image
resize ( integer $newWidth, integer $newHeight, string $option = 'auto', string $backgroundColor = '#000000', integer $sourceX, integer $sourceY ) : Image Resize image
save ( string $savePath, integer $imageQuality = 90 ) : boolean Save image

Protected Methods

Method Description
crop ( integer $newWidth, integer $newHeight, integer $sourceX, integer $sourceY ) : Image Crop image
getSizeByFixedHeight ( integer $newHeight ) : double Get fixed height
getSizeByFixedWidth ( integer $newWidth ) : double Get fixed width

Method Details

__construct() public method

Initialize object
public __construct ( string $filename = null )
$filename string filename

crop() protected method

Crop image
protected crop ( integer $newWidth, integer $newHeight, integer $sourceX, integer $sourceY ) : Image
$newWidth integer New width
$newHeight integer New height
$sourceX integer Source x
$sourceY integer Source y
return Image

getSizeByFixedHeight() protected method

Get fixed height
protected getSizeByFixedHeight ( integer $newHeight ) : double
$newHeight integer New height
return double

getSizeByFixedWidth() protected method

Get fixed width
protected getSizeByFixedWidth ( integer $newWidth ) : double
$newWidth integer New width
return double

hex2rgb() public method

Convert hexa string to rbg
public hex2rgb ( string $hexString ) : resource
$hexString string Hexadecimal string
return resource

open() public method

Open image
public open ( string $file ) : Image
$file string File
return Image

resize() public method

Resize image
public resize ( integer $newWidth, integer $newHeight, string $option = 'auto', string $backgroundColor = '#000000', integer $sourceX, integer $sourceY ) : Image
$newWidth integer New width
$newHeight integer New height
$option string Option can be (auto|crop)
$backgroundColor string Background color
$sourceX integer Source x
$sourceY integer Source y
return Image

save() public method

Save image
public save ( string $savePath, integer $imageQuality = 90 ) : boolean
$savePath string Save path
$imageQuality integer Image quality default is 90
return boolean

Property Details

$availableOptions protected_oe property

Available options
protected array $availableOptions
return array

$height protected_oe property

Original image height
protected int $height
return integer

$image protected_oe property

Original image
protected resource $image
return resource

$imageResized protected_oe property

Image resized
protected resource $imageResized
return resource

$width protected_oe property

Original image width
protected int $width
return integer