PHP Класс Eventviva\ImageResize

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$interlace
$quality_jpg
$quality_png
$source_type

Защищенные свойства (Protected)

Свойство Тип Описание
$dest_h
$dest_w
$dest_x
$dest_y
$original_h
$original_w
$source_h
$source_image
$source_w
$source_x
$source_y

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

Метод Описание
__construct ( string $filename ) : ImageResize Loads image source and its properties to the instanciated object
__toString ( ) : string Convert the image to string with the current settings
createFromString ( string $image_data ) : ImageResize Create instance from a strng
crop ( integer $width, integer $height, boolean $allow_enlarge = false, integer $position = self::CROPCENTER ) : static Crops image according to the given width, height and crop position
freecrop ( integer $width, integer $height, integer $x = false, integer $y = false ) : static Crops image according to the given width, height, x and y
getDestHeight ( ) : integer Gets height of the destination image
getDestWidth ( ) : integer Gets width of the destination image
getImageAsString ( integer $image_type = null, integer $quality = null ) : string Convert the image to string
getSourceHeight ( ) : integer Gets source height
getSourceWidth ( ) : integer Gets source width
imageCreateJpegfromExif ( $filename ) http://stackoverflow.com/a/28819866
output ( string $image_type = null, integer $quality = null ) Outputs image to browser
resize ( integer $width, integer $height, boolean $allow_enlarge = false ) : static Resizes image according to the given width and height
resizeToBestFit ( integer $max_width, integer $max_height, boolean $allow_enlarge = false ) : static Resizes image to best fit inside the given dimensions
resizeToHeight ( integer $height, boolean $allow_enlarge = false ) : static Resizes image according to the given height (width proportional)
resizeToWidth ( integer $width, boolean $allow_enlarge = false ) : static Resizes image according to the given width (height proportional)
save ( string $filename, string $image_type = null, integer $quality = null, integer $permissions = null ) : static Saves new image
scale ( integer | float $scale ) : static Resizes image according to given scale (proportionally)

Защищенные методы

Метод Описание
getCropPosition ( integer $expectedSize, integer $position = self::CROPCENTER ) : integer Gets crop position (X or Y) according to the given position

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

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

Loads image source and its properties to the instanciated object
public __construct ( string $filename ) : ImageResize
$filename string
Результат ImageResize

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

Convert the image to string with the current settings
public __toString ( ) : string
Результат string

createFromString() публичный статический Метод

Create instance from a strng
public static createFromString ( string $image_data ) : ImageResize
$image_data string
Результат ImageResize

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

Crops image according to the given width, height and crop position
public crop ( integer $width, integer $height, boolean $allow_enlarge = false, integer $position = self::CROPCENTER ) : static
$width integer
$height integer
$allow_enlarge boolean
$position integer
Результат static

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

Crops image according to the given width, height, x and y
public freecrop ( integer $width, integer $height, integer $x = false, integer $y = false ) : static
$width integer
$height integer
$x integer
$y integer
Результат static

getCropPosition() защищенный Метод

Gets crop position (X or Y) according to the given position
protected getCropPosition ( integer $expectedSize, integer $position = self::CROPCENTER ) : integer
$expectedSize integer
$position integer
Результат integer

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

Gets height of the destination image
public getDestHeight ( ) : integer
Результат integer

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

Gets width of the destination image
public getDestWidth ( ) : integer
Результат integer

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

Convert the image to string
public getImageAsString ( integer $image_type = null, integer $quality = null ) : string
$image_type integer
$quality integer
Результат string

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

Gets source height
public getSourceHeight ( ) : integer
Результат integer

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

Gets source width
public getSourceWidth ( ) : integer
Результат integer

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

http://stackoverflow.com/a/28819866
public imageCreateJpegfromExif ( $filename )

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

Outputs image to browser
public output ( string $image_type = null, integer $quality = null )
$image_type string
$quality integer

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

Resizes image according to the given width and height
public resize ( integer $width, integer $height, boolean $allow_enlarge = false ) : static
$width integer
$height integer
$allow_enlarge boolean
Результат static

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

Resizes image to best fit inside the given dimensions
public resizeToBestFit ( integer $max_width, integer $max_height, boolean $allow_enlarge = false ) : static
$max_width integer
$max_height integer
$allow_enlarge boolean
Результат static

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

Resizes image according to the given height (width proportional)
public resizeToHeight ( integer $height, boolean $allow_enlarge = false ) : static
$height integer
$allow_enlarge boolean
Результат static

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

Resizes image according to the given width (height proportional)
public resizeToWidth ( integer $width, boolean $allow_enlarge = false ) : static
$width integer
$allow_enlarge boolean
Результат static

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

Saves new image
public save ( string $filename, string $image_type = null, integer $quality = null, integer $permissions = null ) : static
$filename string
$image_type string
$quality integer
$permissions integer
Результат static

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

Resizes image according to given scale (proportionally)
public scale ( integer | float $scale ) : static
$scale integer | float
Результат static

Описание свойств

$dest_h защищенное свойство

protected $dest_h

$dest_w защищенное свойство

protected $dest_w

$dest_x защищенное свойство

protected $dest_x

$dest_y защищенное свойство

protected $dest_y

$interlace публичное свойство

public $interlace

$original_h защищенное свойство

protected $original_h

$original_w защищенное свойство

protected $original_w

$quality_jpg публичное свойство

public $quality_jpg

$quality_png публичное свойство

public $quality_png

$source_h защищенное свойство

protected $source_h

$source_image защищенное свойство

protected $source_image

$source_type публичное свойство

public $source_type

$source_w защищенное свойство

protected $source_w

$source_x защищенное свойство

protected $source_x

$source_y защищенное свойство

protected $source_y