PHP 인터페이스 Imbo\Database\DatabaseInterface

This is an interface for storage adapters in Imbo.
저자: Christer Edvartsen ([email protected])
파일 보기 프로젝트 열기: imbo/imbo

공개 메소드들

메소드 설명
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