PHP 클래스 Ansel_Image, horde

Copyright 2001-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
저자: Chuck Hagenbuch ([email protected])
저자: Michael J. Rubinsky ([email protected])
상속: implements Iterator
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$caption string Image caption
$commentCount integer The number of comments for this image, if available.
$facesCount integer Number of faces in this image
$filename string The filename for this image
$gallery integer The gallery id of this image's parent gallery
$geotag_timestamp integer Timestamp for when image was geotagged
$id integer Image Id
$lat string Latitude
$lng string Longitude
$location string Textual location
$originalDate integer Timestamp of original date.
$sort integer Sort count for this image
$type string The image's mime type
$uploaded integer Timestamp of uploaded datetime

보호된 프로퍼티들

프로퍼티 타입 설명
$_data array Binary image data for loaded views
$_dirty boolean Dirty flag
$_exif array Cache the raw EXIF data locally
$_image Horde_Image_Base Horde_Image object for this image.
$_loaded array Flags for loaded views
$_tags array Holds an array of tags for this image

공개 메소드들

메소드 설명
__construct ( array $image = [] ) : Ansel_Image Const'r
addEffect ( string $type, array $params = [] ) Add an effect to the effect stack
applyEffects ( ) Apply any pending effects to the underlaying Horde_Image
createView ( string $view, Ansel_Style $style = null, $watermark = '' ) Creates and caches the given view.
crop ( integer $x1, integer $y1, integer $x2, integer $y2 ) Crop this image to desired dimensions. Crops the currently loaded view present in the Horde_Image object.
current ( ) : Ansel_Image Return the current image from the internal iterator.
deleteCache ( string $view = 'all' ) Deletes the specified cache file.
display ( string $view = 'full', Ansel_Style $style = null ) Display the requested view.
downloadHeaders ( string $view = 'full' ) Sends the correct HTTP headers to the browser to download this image.
flip ( string $view = 'full' ) Flips the image.
geotag ( string $lat, string $lng, string $location = '' ) Update the image's geotag data. Saves to backend storage as well, so no need to call self::save()
getAttributes ( ) : array Get the image attributes from the backend.
getDimensions ( string $view = 'full' ) : array Returns the dimensions of the given view.
getEXIF ( boolean $replacing = false ) : boolean Reads the EXIF data from the image, caches in the object and writes to storage. Also populates any local properties that come from the EXIF data.
getHordeImage ( ) : Horde_Image_Base Obtain a reference to the underlying Horde_Image
getImagePageCount ( ) : integer Get the number of pages that a multipage image contains.
getTags ( ) : array Returns this image's tags.
getTile ( Ansel_Gallery $parent = null, Ansel_Style $style = null, boolean $mini = false, array $params = [] ) : string Get the Ansel_View_Image_Thumb object
getType ( $view = 'full' ) : string Get the image type for the requested view.
getVFSName ( string $view ) : string Returns the file name of this image as used in the VFS backend.
getVFSPath ( string $view = 'full', Ansel_Style $style = null ) : string Return the vfs path for this image.
getVFSPathFromHash ( string $hash ) : string Generate a path on the VFS given a known style hash.
getViewHash ( string $view, Ansel_Style $style = null ) : string Return a hash key for the given view and style.
grayscale ( string $view = 'full' ) Converts the image to grayscale.
isMultiPage ( ) : boolean Indicates if this image represents a multipage image.
key ( ) : integer Get the index of the internal iterator.
load ( string $view = 'full', Ansel_Style $style = null ) Loads the given view into memory.
mirror ( string $view = 'full' ) Mirrors the image.
next ( ) : mixed Advance the iterator
raw ( string $view = 'full' ) : string Returns the raw data for the given view.
removeTag ( string $tag ) Remove a single tag from this image's tag collection
replace ( array $imageData ) : void Replace this image's image data.
reset ( ) Reset the image, removing all loaded views.
resize ( integer $width, integer $height, boolean $ratio = true, boolean $keepProfile = false ) Resize the current image.
rewind ( ) : void Reset the iterator to the first image in the set.
rotate ( string $view = 'full', integer $angle = 90 ) Rotates the image.
save ( ) : integer Save image details to storage.
setTags ( array $tags, boolean $replace = true ) Either add or replace this image's tags.
toFile ( string $view = 'full' ) : string Wraps the given view into a file.
updateData ( string $data, string $view = 'full' ) Change the image data. Deletes old cache and writes the new data to the VFS. Used when updating an image
valid ( ) : boolean Deterimines if the current iterator item is valid.
viewExists ( integer $id, string $view, Ansel_Style $style ) : mixed Check if an image view exists and returns the vfs name complete with the hash directory name prepended if appropriate.
watermark ( string $view = 'full', string $watermark = null, string $halign = null, string $valign = null, string $font = null ) Watermarks the image.

보호된 메소드들

메소드 설명
_autoRotate ( $orientation ) Autorotate based on EXIF orientation field. Updates the data in memory only.
_buildImageObject ( Horde_Image_Base $image ) : Ansel_Image Build an Ansel_Image from a given Horde_Image.
_exifToTags ( array $fields = [] ) : void Adds specified EXIF fields to this image's tags.
_writeData ( ) : boolean Writes the current data to vfs, used when creating a new image

메소드 상세

__construct() 공개 메소드

Const'r
public __construct ( array $image = [] ) : Ansel_Image
$image array
리턴 Ansel_Image

_autoRotate() 보호된 메소드

Autorotate based on EXIF orientation field. Updates the data in memory only.
protected _autoRotate ( $orientation )

_buildImageObject() 보호된 메소드

Used to wrap iterating the Horde_Image
protected _buildImageObject ( Horde_Image_Base $image ) : Ansel_Image
$image Horde_Image_Base The Horde_Image
리턴 Ansel_Image

_exifToTags() 보호된 메소드

Called during image upload/creation.
protected _exifToTags ( array $fields = [] ) : void
$fields array An array of EXIF fields to import as a tag.
리턴 void

_writeData() 보호된 메소드

Writes the current data to vfs, used when creating a new image
protected _writeData ( ) : boolean
리턴 boolean

addEffect() 공개 메소드

Add an effect to the effect stack
public addEffect ( string $type, array $params = [] )
$type string The effect to add.
$params array The effect parameters.

applyEffects() 공개 메소드

Apply any pending effects to the underlaying Horde_Image
public applyEffects ( )

createView() 공개 메소드

Creates and caches the given view.
public createView ( string $view, Ansel_Style $style = null, $watermark = '' )
$view string Which view to create.
$style Ansel_Style A style object

crop() 공개 메소드

Crop this image to desired dimensions. Crops the currently loaded view present in the Horde_Image object.
또한 보기: Horde_Image_Base::crop for explanation of parameters
public crop ( integer $x1, integer $y1, integer $x2, integer $y2 )
$x1 integer
$y1 integer
$x2 integer
$y2 integer

current() 공개 메소드

Return the current image from the internal iterator.
public current ( ) : Ansel_Image
리턴 Ansel_Image

deleteCache() 공개 메소드

If none is specified, deletes all of the cache files.
public deleteCache ( string $view = 'all' )
$view string Which cache file to delete.

display() 공개 메소드

Display the requested view.
public display ( string $view = 'full', Ansel_Style $style = null )
$view string Which view to display.
$style Ansel_Style Force use of this gallery style.

downloadHeaders() 공개 메소드

Sends the correct HTTP headers to the browser to download this image.
public downloadHeaders ( string $view = 'full' )
$view string The view to download.

flip() 공개 메소드

Flips the image.
public flip ( string $view = 'full' )
$view string The view to work with.

geotag() 공개 메소드

Update the image's geotag data. Saves to backend storage as well, so no need to call self::save()
public geotag ( string $lat, string $lng, string $location = '' )
$lat string Latitude
$lng string Longitude
$location string Textual location

getAttributes() 공개 메소드

Get the image attributes from the backend.
public getAttributes ( ) : array
리턴 array A hash of Exif fieldnames => values.

getDimensions() 공개 메소드

Returns the dimensions of the given view.
public getDimensions ( string $view = 'full' ) : array
$view string The view (full, screen etc..) to get dimensions for
리턴 array A hash of 'width and 'height' dimensions.

getEXIF() 공개 메소드

Reads the EXIF data from the image, caches in the object and writes to storage. Also populates any local properties that come from the EXIF data.
public getEXIF ( boolean $replacing = false ) : boolean
$replacing boolean Set to true if we are replacing the exif data.
리턴 boolean True if any local properties were modified, False if not.

getHordeImage() 공개 메소드

Obtain a reference to the underlying Horde_Image
public getHordeImage ( ) : Horde_Image_Base
리턴 Horde_Image_Base

getImagePageCount() 공개 메소드

Get the number of pages that a multipage image contains.
public getImagePageCount ( ) : integer
리턴 integer The number of pages.

getTags() 공개 메소드

Returns this image's tags.
또한 보기: Ansel_Tags::readTags()
public getTags ( ) : array
리턴 array An array of tags

getTile() 공개 메소드

Get the Ansel_View_Image_Thumb object
public getTile ( Ansel_Gallery $parent = null, Ansel_Style $style = null, boolean $mini = false, array $params = [] ) : string
$parent Ansel_Gallery The parent Ansel_Gallery object.
$style Ansel_Style A gallery definition to use.
$mini boolean Force the use of a mini thumbnail?
$params array Any additional parameters the Ansel_Tile object may need.
리턴 string HTML for this image's view tile.

getType() 공개 메소드

Get the image type for the requested view.
public getType ( $view = 'full' ) : string
리턴 string The requested view's mime type

getVFSName() 공개 메소드

Returns the file name of this image as used in the VFS backend.
public getVFSName ( string $view ) : string
$view string The image view (full, screen, thumb, mini).
리턴 string This image's VFS file name.

getVFSPath() 공개 메소드

Return the vfs path for this image.
public getVFSPath ( string $view = 'full', Ansel_Style $style = null ) : string
$view string The view we want.
$style Ansel_Style A gallery style.
리턴 string The vfs path for this image.

getVFSPathFromHash() 공개 메소드

Generate a path on the VFS given a known style hash.
public getVFSPathFromHash ( string $hash ) : string
$hash string The sytle hash
리턴 string the VFS path to the directory for the provided hash

getViewHash() 공개 메소드

Return a hash key for the given view and style.
public getViewHash ( string $view, Ansel_Style $style = null ) : string
$view string The view (thumb, prettythumb etc...)
$style Ansel_Style The style.
리턴 string A md5 hash suitable for use as a key.

grayscale() 공개 메소드

Converts the image to grayscale.
public grayscale ( string $view = 'full' )
$view string The view (screen, full, etc...) to work with.

isMultiPage() 공개 메소드

Indicates if this image represents a multipage image.
public isMultiPage ( ) : boolean
리턴 boolean

key() 공개 메소드

Get the index of the internal iterator.
public key ( ) : integer
리턴 integer

load() 공개 메소드

Loads the given view into memory.
public load ( string $view = 'full', Ansel_Style $style = null )
$view string Which view to load.
$style Ansel_Style The gallery style.

mirror() 공개 메소드

Mirrors the image.
public mirror ( string $view = 'full' )
$view string The view (size) to work with.

next() 공개 메소드

Advance the iterator
public next ( ) : mixed
리턴 mixed Ansel_Image or false if not valid()

raw() 공개 메소드

Returns the raw data for the given view.
public raw ( string $view = 'full' ) : string
$view string Which view to return.
리턴 string The raw binary image data

removeTag() 공개 메소드

Remove a single tag from this image's tag collection
public removeTag ( string $tag )
$tag string The tag name to remove.

replace() 공개 메소드

Replace this image's image data.
public replace ( array $imageData ) : void
$imageData array An array of image data, the same keys as Const'r
리턴 void

reset() 공개 메소드

Reset the image, removing all loaded views.
public reset ( )

resize() 공개 메소드

Resize the current image.
public resize ( integer $width, integer $height, boolean $ratio = true, boolean $keepProfile = false )
$width integer The new width.
$height integer The new height.
$ratio boolean Maintain original aspect ratio.
$keepProfile boolean Keep the image meta data.

rewind() 공개 메소드

Reset the iterator to the first image in the set.
public rewind ( ) : void
리턴 void

rotate() 공개 메소드

Rotates the image.
public rotate ( string $view = 'full', integer $angle = 90 )
$view string The view (size) to work with.
$angle integer What angle to rotate the image by.

save() 공개 메소드

Save image details to storage.
public save ( ) : integer
리턴 integer image id

setTags() 공개 메소드

Either add or replace this image's tags.
public setTags ( array $tags, boolean $replace = true )
$tags array An array of tag names
$replace boolean Replace all tags with those provided.

toFile() 공개 메소드

Wraps the given view into a file.
사용 중단: Not used anywhere, remove in A4.
public toFile ( string $view = 'full' ) : string
$view string Which view to wrap up.
리턴 string Path to temporary file.

updateData() 공개 메소드

Change the image data. Deletes old cache and writes the new data to the VFS. Used when updating an image
public updateData ( string $data, string $view = 'full' )
$data string The new data for this image.
$view string If specified, the $data represents only this particular view. Cache will not be deleted.

valid() 공개 메소드

Deterimines if the current iterator item is valid.
public valid ( ) : boolean
리턴 boolean

viewExists() 공개 정적인 메소드

Check if an image view exists and returns the vfs name complete with the hash directory name prepended if appropriate.
public static viewExists ( integer $id, string $view, Ansel_Style $style ) : mixed
$id integer Image id to check
$view string Which view to check for
$style Ansel_Style Style object
리턴 mixed False if image does not exists | string vfs name

watermark() 공개 메소드

Watermarks the image.
public watermark ( string $view = 'full', string $watermark = null, string $halign = null, string $valign = null, string $font = null )
$view string The view (size) to work with.
$watermark string String to use as the watermark.
$halign string Horizontal alignment (Left, Right, Center)
$valign string Vertical alignment (Top, Center, Bottom)
$font string The font to use (not all image drivers will support this).

프로퍼티 상세

$_data 보호되어 있는 프로퍼티

Binary image data for loaded views
protected array $_data
리턴 array

$_dirty 보호되어 있는 프로퍼티

Dirty flag
protected bool $_dirty
리턴 boolean

$_exif 보호되어 있는 프로퍼티

Cache the raw EXIF data locally
protected array $_exif
리턴 array

$_image 보호되어 있는 프로퍼티

Horde_Image object for this image.
protected Horde_Image_Base $_image
리턴 Horde_Image_Base

$_loaded 보호되어 있는 프로퍼티

Flags for loaded views
protected array $_loaded
리턴 array

$_tags 보호되어 있는 프로퍼티

Holds an array of tags for this image
protected array $_tags
리턴 array

$caption 공개적으로 프로퍼티

Image caption
public string $caption
리턴 string

$commentCount 공개적으로 프로퍼티

The number of comments for this image, if available.
public int $commentCount
리턴 integer

$facesCount 공개적으로 프로퍼티

Number of faces in this image
public int $facesCount
리턴 integer

$filename 공개적으로 프로퍼티

The filename for this image
public string $filename
리턴 string

$geotag_timestamp 공개적으로 프로퍼티

Timestamp for when image was geotagged
public int $geotag_timestamp
리턴 integer

$id 공개적으로 프로퍼티

Image Id
public int $id
리턴 integer

$lat 공개적으로 프로퍼티

Latitude
public string $lat
리턴 string

$lng 공개적으로 프로퍼티

Longitude
public string $lng
리턴 string

$location 공개적으로 프로퍼티

Textual location
public string $location
리턴 string

$originalDate 공개적으로 프로퍼티

Timestamp of original date.
public int $originalDate
리턴 integer

$sort 공개적으로 프로퍼티

Sort count for this image
public int $sort
리턴 integer

$type 공개적으로 프로퍼티

The image's mime type
public string $type
리턴 string

$uploaded 공개적으로 프로퍼티

Timestamp of uploaded datetime
public int $uploaded
리턴 integer