PHP Class Gc\Media\Image

Afficher le fichier Open project: gotcms/gotcms Class Usage Examples

Protected Properties

Свойство Type Description
$availableOptions array Available options
$height integer Original image height
$image resource Original image
$imageResized resource Image resized
$width integer Original image width

Méthodes publiques

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

Méthodes protégées

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

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

crop() protected méthode

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

getSizeByFixedHeight() protected méthode

Get fixed height
protected getSizeByFixedHeight ( integer $newHeight ) : double
$newHeight integer New height
Résultat double

getSizeByFixedWidth() protected méthode

Get fixed width
protected getSizeByFixedWidth ( integer $newWidth ) : double
$newWidth integer New width
Résultat double

hex2rgb() public méthode

Convert hexa string to rbg
public hex2rgb ( string $hexString ) : resource
$hexString string Hexadecimal string
Résultat resource

open() public méthode

Open image
public open ( string $file ) : Image
$file string File
Résultat Image

resize() public méthode

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

save() public méthode

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

Property Details

$availableOptions protected_oe property

Available options
protected array $availableOptions
Résultat array

$height protected_oe property

Original image height
protected int $height
Résultat integer

$image protected_oe property

Original image
protected resource $image
Résultat resource

$imageResized protected_oe property

Image resized
protected resource $imageResized
Résultat resource

$width protected_oe property

Original image width
protected int $width
Résultat integer