PHP Класс Gregwar\Image\Image

Автор: Gregwar ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$types Supported types.

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

Свойство Тип Описание
$adapter Gregwar\Image\Adapter\AdapterInterface Internal adapter.
$cache Gregwar\Cache\CacheInterface Cache system.
$cacheDir Directory to use for file caching.
$cacheMode Directory cache mode.
$fallback Fallback image.
$forceCache Force image caching, even if there is no operation applied.
$hash Transformations hash.
$operations Operations array.
$prettyName Pretty name for the image.
$prettyPrefix
$source The image source.
$useFallbackImage Use fallback image.

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

Метод Описание
__call ( $methodName, $args ) Generic function.
__construct ( $originalFile = null, $width = null, $height = null )
__toString ( ) Tostring defaults to jpeg.
applyOperations ( ) Applies the operations.
cacheData ( string $type = 'jpg', integer $quality = 80 ) Get cache data (to render the image).
cacheFile ( string $type = 'jpg', integer $quality = 80, $actual = false ) Gets the cache file name and generate it if it does not exists.
correct ( ) Tells if the image is correct.
create ( $width, $height ) Creates an instance of a new resource.
fromData ( $data ) Creates an instance of image from its data.
fromFile ( string $originalFile ) Defines the file only after instantiation.
fromResource ( $resource ) Creates an instance of image from resource.
generateHash ( $type = 'guess', $quality = 80 ) Generates the hash.
get ( $type = 'guess', $quality = 80 ) Get the contents of the image.
getAdapter ( ) : Gregwar\Image\Adapter\AdapterInterface
getCacheFallback ( ) Gets the fallback into the cache dir.
getCacheSystem ( ) : Gregwar\Cache\CacheInterface Get the cache system.
getDependencies ( ) : string[] Get all the files that this image depends on.
getFallback ( ) Gets the fallack image path.
getFilePath ( ) : mixed Get the file path.
getHash ( $type = 'guess', $quality = 80 ) Gets the hash.
gif ( ) Generates and output a gif cached file.
guess ( $quality = 80 ) Generates and output an image using the same type as input.
guessType ( ) Guess the file type.
height ( ) Image height.
html ( $title = '', $type = 'jpg', $quality = 80 ) Returning basic html code for this image.
init ( ) Initialize the adapter.
inline ( $type = 'jpg', $quality = 80 ) Returns the Base64 inlinable representation.
jpeg ( $quality = 80 ) Generates and output a jpeg cached file.
open ( $file = '' ) Creates an instance, usefull for one-line chaining.
png ( ) Generates and output a png cached file.
save ( $file, $type = 'guess', $quality = 80 ) Save the file to a given output.
serializeOperations ( ) Serialization of operations.
setActualCacheDir ( $actualCacheDir ) The actual cache dir.
setAdapter ( $adapter )
setCacheDir ( $cacheDir ) Change the caching directory.
setCacheDirMode ( integer $dirMode )
setCacheSystem ( Gregwar\Cache\CacheInterface $cache ) Set the cache system.
setData ( $data ) Sets the image data.
setFallback ( $fallback = null ) Sets the fallback image to use.
setForceCache ( $forceCache = true ) Enable or disable to force cache even if the file is unchanged.
setPrettyName ( $name, $prefix = true ) Sets the pretty name of the image.
setResource ( $resource ) Sets the resource.
useFallback ( $useFallbackImage = true ) Use the fallback image or not.
width ( ) Image width.

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

Метод Описание
addOperation ( $method, $args ) Adds an operation.
getFilename ( $filename ) Hook to helps to extends and enhance this class.
urlize ( $name ) Urlizes the prettyName.

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

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

Generic function.
public __call ( $methodName, $args )

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

public __construct ( $originalFile = null, $width = null, $height = null )

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

Tostring defaults to jpeg.
public __toString ( )

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

Adds an operation.
protected addOperation ( $method, $args )

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

Applies the operations.
public applyOperations ( )

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

Get cache data (to render the image).
public cacheData ( string $type = 'jpg', integer $quality = 80 )
$type string the image type
$quality integer the quality (for JPEG)

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

Note that if it exists, all the image computation process will not be done.
public cacheFile ( string $type = 'jpg', integer $quality = 80, $actual = false )
$type string the image type
$quality integer the quality (for JPEG)

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

Tells if the image is correct.
public correct ( )

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

Creates an instance of a new resource.
public static create ( $width, $height )

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

Creates an instance of image from its data.
public static fromData ( $data )

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

Defines the file only after instantiation.
public fromFile ( string $originalFile )
$originalFile string the file path

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

Creates an instance of image from resource.
public static fromResource ( $resource )

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

Generates the hash.
public generateHash ( $type = 'guess', $quality = 80 )

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

Get the contents of the image.
public get ( $type = 'guess', $quality = 80 )

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

public getAdapter ( ) : Gregwar\Image\Adapter\AdapterInterface
Результат Gregwar\Image\Adapter\AdapterInterface

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

Gets the fallback into the cache dir.
public getCacheFallback ( )

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

Get the cache system.
public getCacheSystem ( ) : Gregwar\Cache\CacheInterface
Результат Gregwar\Cache\CacheInterface

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

Get all the files that this image depends on.
public getDependencies ( ) : string[]
Результат string[] this is an array of strings containing all the files that the current Image depends on

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

Gets the fallack image path.
public getFallback ( )

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

Get the file path.
public getFilePath ( ) : mixed
Результат mixed a string with the filen name, null if the image does not depends on a file

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

Hook to helps to extends and enhance this class.
protected getFilename ( $filename )

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

Gets the hash.
public getHash ( $type = 'guess', $quality = 80 )

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

Generates and output a gif cached file.
public gif ( )

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

Generates and output an image using the same type as input.
public guess ( $quality = 80 )

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

Guess the file type.
public guessType ( )

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

Image height.
public height ( )

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

Returning basic html code for this image.
public html ( $title = '', $type = 'jpg', $quality = 80 )

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

Initialize the adapter.
public init ( )

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

Returns the Base64 inlinable representation.
public inline ( $type = 'jpg', $quality = 80 )

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

Generates and output a jpeg cached file.
public jpeg ( $quality = 80 )

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

Creates an instance, usefull for one-line chaining.
public static open ( $file = '' )

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

Generates and output a png cached file.
public png ( )

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

Save the file to a given output.
public save ( $file, $type = 'guess', $quality = 80 )

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

Serialization of operations.
public serializeOperations ( )

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

The actual cache dir.
public setActualCacheDir ( $actualCacheDir )

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

public setAdapter ( $adapter )

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

Change the caching directory.
public setCacheDir ( $cacheDir )

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

public setCacheDirMode ( integer $dirMode )
$dirMode integer

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

Set the cache system.
public setCacheSystem ( Gregwar\Cache\CacheInterface $cache )
$cache Gregwar\Cache\CacheInterface

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

Sets the image data.
public setData ( $data )

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

Sets the fallback image to use.
public setFallback ( $fallback = null )

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

Enable or disable to force cache even if the file is unchanged.
public setForceCache ( $forceCache = true )

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

Sets the pretty name of the image.
public setPrettyName ( $name, $prefix = true )

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

Sets the resource.
public setResource ( $resource )

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

Urlizes the prettyName.
protected urlize ( $name )

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

Use the fallback image or not.
public useFallback ( $useFallbackImage = true )

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

Image width.
public width ( )

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

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

Internal adapter.
protected AdapterInterface,Gregwar\Image\Adapter $adapter
Результат Gregwar\Image\Adapter\AdapterInterface

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

Cache system.
protected CacheInterface,Gregwar\Cache $cache
Результат Gregwar\Cache\CacheInterface

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

Directory to use for file caching.
protected $cacheDir

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

Directory cache mode.
protected $cacheMode

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

Fallback image.
protected $fallback

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

Force image caching, even if there is no operation applied.
protected $forceCache

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

Transformations hash.
protected $hash

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

Operations array.
protected $operations

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

Pretty name for the image.
protected $prettyName

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

protected $prettyPrefix

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

The image source.
protected $source

$types публичное статическое свойство

Supported types.
public static $types

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

Use fallback image.
protected $useFallbackImage