PHP Интерфейс Imbo\Database\DatabaseInterface

This is an interface for storage adapters in Imbo.
Автор: Christer Edvartsen ([email protected])
Показать файл Открыть проект

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

Метод Описание
deleteImage ( string $user, string $imageIdentifier ) : boolean Delete an image from the database
deleteMetadata ( string $user, string $imageIdentifier ) : boolean Delete all metadata associated with an image
deleteShortUrls ( string $user, string $imageIdentifier, string $shortUrlId = null ) : boolean Delete short URLs attached to a specific image, or a single short URL
getImageMimeType ( string $user, string $imageIdentifier ) : string Get the mime type of an image
getImageProperties ( string $user, string $imageIdentifier ) : array Fetch image properties from the database
getImages ( array $users, Query $query, Images $model ) : array Get images based on some query parameters
getLastModified ( array $users, string $imageIdentifier = null ) : DateTime Get the last modified timestamp for given users
getMetadata ( string $user, string $imageIdentifier ) : array Get all metadata associated with an image
getNumBytes ( string $user = null ) : integer Fetch the number of bytes stored, optionally filtered by a given user
getNumImages ( string $user = null ) : integer Fetch the number of images, optionally filtered by a given user
getNumUsers ( ) : integer Fetch the number of users which has one or more images
getShortUrlId ( string $user, string $imageIdentifier, string $extension = null, array $query = [] ) : string | null Fetch the short URL identifier
getShortUrlParams ( string $shortUrlId ) : array | null Fetch parameters for a short URL
getStatus ( ) : boolean Get the current status of the database connection
imageExists ( string $user, string $imageIdentifier ) : boolean Check if an image already exists
insertImage ( string $user, string $imageIdentifier, Image $image ) : boolean Insert a new image
insertShortUrl ( string $shortUrlId, string $user, string $imageIdentifier, string $extension = null, array $query = [] ) : boolean Insert a short URL
load ( string $user, string $imageIdentifier, Image $image ) : boolean Load information from database into the image object
updateMetadata ( string $user, string $imageIdentifier, array $metadata ) : boolean Edit metadata

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

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

Delete an image from the database
public deleteImage ( string $user, string $imageIdentifier ) : boolean
$user string The user which the image belongs to
$imageIdentifier string Image identifier
Результат boolean Returns true on success or false on failure

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

Delete all metadata associated with an image
public deleteMetadata ( string $user, string $imageIdentifier ) : boolean
$user string The user which the image belongs to
$imageIdentifier string Image identifier
Результат boolean Returns true on success or false on failure

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

Delete short URLs attached to a specific image, or a single short URL
public deleteShortUrls ( string $user, string $imageIdentifier, string $shortUrlId = null ) : boolean
$user string The user attached to the URL
$imageIdentifier string The image identifier attached to the URL
$shortUrlId string Specify to delete a single short URL for a specific image owned by a user
Результат boolean

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

Get the mime type of an image
public getImageMimeType ( string $user, string $imageIdentifier ) : string
$user string The user which the image belongs to who owns the image
$imageIdentifier string The image identifier
Результат string Returns the mime type of the image

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

Fetch image properties from the database
public getImageProperties ( string $user, string $imageIdentifier ) : array
$user string The user which the image belongs to
$imageIdentifier string The image identifier
Результат array

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

This method is also responsible for setting a correct "hits" number in the images model.
public getImages ( array $users, Query $query, Images $model ) : array
$users array The users which the images belongs to
$query Imbo\Resource\Images\Query A query instance
$model Imbo\Model\Images The images model
Результат array

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

If the $imageIdentifier parameter is set, return when that image was last updated. If not set, return the most recent date when one of the specified users last updated any image. If the provided users does not have any images stored, return the current timestamp.
public getLastModified ( array $users, string $imageIdentifier = null ) : DateTime
$users array The users
$imageIdentifier string The image identifier
Результат DateTime Returns an instance of DateTime

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

Get all metadata associated with an image
public getMetadata ( string $user, string $imageIdentifier ) : array
$user string The user which the image belongs to
$imageIdentifier string Image identifier
Результат array Returns the metadata as an array

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

Fetch the number of bytes stored, optionally filtered by a given user
public getNumBytes ( string $user = null ) : integer
$user string The user which the images belongs to (pass null to count for all users)
Результат integer Returns the number of bytes

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

Fetch the number of images, optionally filtered by a given user
public getNumImages ( string $user = null ) : integer
$user string The user which the images belongs to (pass null to count for all users)
Результат integer Returns the number of images

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

Fetch the number of users which has one or more images
public getNumUsers ( ) : integer
Результат integer Returns the number of users

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

Fetch the short URL identifier
public getShortUrlId ( string $user, string $imageIdentifier, string $extension = null, array $query = [] ) : string | null
$user string The user attached to the URL
$imageIdentifier string The image identifier attached to the URL
$extension string Optionl image extension
$query array Optional query parameters
Результат string | null

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

Fetch parameters for a short URL
public getShortUrlParams ( string $shortUrlId ) : array | null
$shortUrlId string The ID of the short URL
Результат array | null Returns an array with information regarding the short URL, or null if the short URL is not found

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

This method is used with the status resource.
public getStatus ( ) : boolean
Результат boolean

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

Check if an image already exists
public imageExists ( string $user, string $imageIdentifier ) : boolean
$user string The user which the image belongs to who owns the image
$imageIdentifier string The image identifier
Результат boolean Returns true of the image exists, false otherwise

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

This method will insert a new image into the database. If the same image already exists, just update the "updated" information.
public insertImage ( string $user, string $imageIdentifier, Image $image ) : boolean
$user string The user which the image belongs to
$imageIdentifier string Image identifier
$image Imbo\Model\Image The image to insert
Результат boolean Returns true on success or false on failure

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

Insert a short URL
public insertShortUrl ( string $shortUrlId, string $user, string $imageIdentifier, string $extension = null, array $query = [] ) : boolean
$shortUrlId string The ID of the URL
$user string The user attached to the URL
$imageIdentifier string The image identifier attached to the URL
$extension string Optionl image extension
$query array Optional query parameters
Результат boolean

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

Load information from database into the image object
public load ( string $user, string $imageIdentifier, Image $image ) : boolean
$user string The user which the image belongs to
$imageIdentifier string The image identifier
$image Imbo\Model\Image The image object to populate
Результат boolean

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

Edit metadata
public updateMetadata ( string $user, string $imageIdentifier, array $metadata ) : boolean
$user string The user which the image belongs to
$imageIdentifier string Image identifier
$metadata array An array with metadata
Результат boolean Returns true on success or false on failure