PHP Interface Imbo\Storage\StorageInterface

This is an interface for storage adapters in Imbo.
Author: Christer Edvartsen ([email protected])
Show file Open project: imbo/imbo

Public Methods

Method Description
delete ( string $user, string $imageIdentifier ) : boolean Delete an image
getImage ( string $user, string $imageIdentifier ) : string Get image content
getLastModified ( string $user, string $imageIdentifier ) : DateTime Get the last modified timestamp
getStatus ( ) : boolean Get the current status of the storage
imageExists ( string $user, string $imageIdentifier ) : DateTime See if the image already exists
store ( string $user, string $imageIdentifier, string $imageData ) : boolean Store an image

Method Details

delete() public method

This method will delete the file associated with $imageIdentifier from the storage medium
public delete ( string $user, string $imageIdentifier ) : boolean
$user string The user which the image belongs to
$imageIdentifier string Image identifier
return boolean Returns true on success or false on failure

getImage() public method

Get image content
public getImage ( string $user, string $imageIdentifier ) : string
$user string The user which the image belongs to
$imageIdentifier string Image identifier
return string The binary content of the image

getLastModified() public method

Get the last modified timestamp
public getLastModified ( string $user, string $imageIdentifier ) : DateTime
$user string The user which the image belongs to
$imageIdentifier string Image identifier
return DateTime Returns an instance of DateTime

getStatus() public method

This method is used with the status resource.
public getStatus ( ) : boolean
return boolean

imageExists() public method

See if the image already exists
public imageExists ( string $user, string $imageIdentifier ) : DateTime
$user string The user which the image belongs to
$imageIdentifier string Image identifier
return DateTime Returns an instance of DateTime

store() public method

This method will receive the binary data of the image and store it somewhere suited for the actual storage adaper. If an error occurs the adapter should throw an Imbo\Exception\StorageException exception. If the image already exists, simply overwrite it.
public store ( string $user, string $imageIdentifier, string $imageData ) : boolean
$user string The user which the image belongs to
$imageIdentifier string The image identifier
$imageData string The image data to store
return boolean Returns true on success or false on failure