Properties

$gallery

$gallery : integer

The gallery id of this image's parent gallery

Type

integer

$id

$id : integer

Image Id

Type

integer

$filename

$filename : string

The filename for this image

Type

string

$caption

$caption : string

Image caption

Type

string

$type

$type : string

The image's mime type

Type

string

$uploaded

$uploaded : integer

Timestamp of uploaded datetime

Type

integer

$sort

$sort : integer

Sort count for this image

Type

integer

$commentCount

$commentCount : integer

The number of comments for this image, if available.

Type

integer

$facesCount

$facesCount : integer

Number of faces in this image

Type

integer

$lat

$lat : string

Latitude

Type

string

$lng

$lng : string

Longitude

Type

string

$location

$location : string

Textual location

Type

string

$geotag_timestamp

$geotag_timestamp : integer

Timestamp for when image was geotagged

Type

integer

$originalDate

$originalDate : integer

Timestamp of original date.

Type

integer

$_image

$_image : \Horde_Image_Base

Horde_Image object for this image.

Type

\Horde_Image_Base

$_dirty

$_dirty : boolean

Dirty flag

Type

boolean

$_loaded

$_loaded : array

Flags for loaded views

Type

array

$_data

$_data : array

Binary image data for loaded views

Type

array

$_tags

$_tags : array

Holds an array of tags for this image

Type

array

$_exif

$_exif : array

Cache the raw EXIF data locally

Type

array

Methods

__construct()

__construct(array  $image = array()) : \Ansel_Image

Const'r

Parameters

array $image

Returns

\Ansel_Image

getHordeImage()

getHordeImage() : \Horde_Image_Base

Obtain a reference to the underlying Horde_Image

Returns

\Horde_Image_Base

getVFSPath()

getVFSPath(string  $view = 'full', \Ansel_Style  $style = null) : string

Return the vfs path for this image.

Parameters

string $view

The view we want.

\Ansel_Style $style

A gallery style.

Returns

string —

The vfs path for this image.

getVFSPathFromHash()

getVFSPathFromHash(string  $hash) : string

Generate a path on the VFS given a known style hash.

Parameters

string $hash

The sytle hash

Returns

string —

the VFS path to the directory for the provided hash

getVFSName()

getVFSName(string  $view) : string

Returns the file name of this image as used in the VFS backend.

Parameters

string $view

The image view (full, screen, thumb, mini).

Returns

string —

This image's VFS file name.

load()

load(string  $view = 'full', \Ansel_Style  $style = null) 

Loads the given view into memory.

Parameters

string $view

Which view to load.

\Ansel_Style $style

The gallery style.

Throws

\Ansel_Exception

viewExists()

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.

Parameters

integer $id

Image id to check

string $view

Which view to check for

\Ansel_Style $style

Style object

Returns

mixed —

False if image does not exists | string vfs name

createView()

createView(string  $view, \Ansel_Style  $style = null,   $watermark = '') 

Creates and caches the given view.

Parameters

string $view

Which view to create.

\Ansel_Style $style

A style object

$watermark

Throws

\Ansel_Exception

updateData()

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

Parameters

string $data

The new data for this image.

string $view

If specified, the $data represents only this particular view. Cache will not be deleted.

Throws

\Ansel_Exception

geotag()

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()

Parameters

string $lat

Latitude

string $lng

Longitude

string $location

Textual location

save()

save() : integer

Save image details to storage.

Throws

\Ansel_Exception

Returns

integer —

image id

replace()

replace(array  $imageData) : void

Replace this image's image data.

Parameters

array $imageData

An array of image data, the same keys as Const'r

Throws

\Ansel_Exception

getEXIF()

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.

Parameters

boolean $replacing

Set to true if we are replacing the exif data.

Throws

\Ansel_Exception

Returns

boolean —

True if any local properties were modified, False if not.

reset()

reset() 

Reset the image, removing all loaded views.

deleteCache()

deleteCache(string  $view = 'all') 

Deletes the specified cache file.

If none is specified, deletes all of the cache files.

Parameters

string $view

Which cache file to delete.

raw()

raw(string  $view = 'full') : string

Returns the raw data for the given view.

Parameters

string $view

Which view to return.

Returns

string —

The raw binary image data

downloadHeaders()

downloadHeaders(string  $view = 'full') 

Sends the correct HTTP headers to the browser to download this image.

Parameters

string $view

The view to download.

display()

display(string  $view = 'full', \Ansel_Style  $style = null) 

Display the requested view.

Parameters

string $view

Which view to display.

\Ansel_Style $style

Force use of this gallery style.

Throws

\Horde_Exception_PermissionDenied,

Ansel_Exception

toFile()

toFile(string  $view = 'full') : string

Wraps the given view into a file.

Parameters

string $view

Which view to wrap up.

Returns

string —

Path to temporary file.

getDimensions()

getDimensions(string  $view = 'full') : array

Returns the dimensions of the given view.

Parameters

string $view

The view (full, screen etc..) to get dimensions for

Returns

array —

A hash of 'width and 'height' dimensions.

rotate()

rotate(string  $view = 'full', integer  $angle = 90) 

Rotates the image.

Parameters

string $view

The view (size) to work with.

integer $angle

What angle to rotate the image by.

crop()

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.

Parameters

integer $x1
integer $y1
integer $x2
integer $y2

Throws

\Ansel_Exception

resize()

resize(integer  $width, integer  $height, boolean  $ratio = true, boolean  $keepProfile = false) 

Resize the current image.

Parameters

integer $width

The new width.

integer $height

The new height.

boolean $ratio

Maintain original aspect ratio.

boolean $keepProfile

Keep the image meta data.

Throws

\Ansel_Exception

grayscale()

grayscale(string  $view = 'full') 

Converts the image to grayscale.

Parameters

string $view

The view (screen, full, etc...) to work with.

Throws

\Ansel_Exception

watermark()

watermark(string  $view = 'full', string  $watermark = null, string  $halign = null, string  $valign = null, string  $font = null) 

Watermarks the image.

Parameters

string $view

The view (size) to work with.

string $watermark

String to use as the watermark.

string $halign

Horizontal alignment (Left, Right, Center)

string $valign

Vertical alignment (Top, Center, Bottom)

string $font

The font to use (not all image drivers will support this).

Throws

\Ansel_Exception

flip()

flip(string  $view = 'full') 

Flips the image.

Parameters

string $view

The view to work with.

Throws

\Ansel_Exception

mirror()

mirror(string  $view = 'full') 

Mirrors the image.

Parameters

string $view

The view (size) to work with.

Throws

\Ansel_Exception

addEffect()

addEffect(string  $type, array  $params = array()) 

Add an effect to the effect stack

Parameters

string $type

The effect to add.

array $params

The effect parameters.

Throws

\Ansel_Exception

applyEffects()

applyEffects() 

Apply any pending effects to the underlaying Horde_Image

Throws

\Ansel_Exception

getTags()

getTags() : array

Returns this image's tags.

Throws

\Horde_Exception_PermissionDenied,

Ansel_Exception

Returns

array —

An array of tags

setTags()

setTags(array  $tags, boolean  $replace = true) 

Either add or replace this image's tags.

Parameters

array $tags

An array of tag names

boolean $replace

Replace all tags with those provided.

Throws

\Horde_Exception_PermissionDenied

removeTag()

removeTag(string  $tag) 

Remove a single tag from this image's tag collection

Parameters

string $tag

The tag name to remove.

getTile()

getTile(\Ansel_Gallery  $parent = null, \Ansel_Style  $style = null, boolean  $mini = false, array  $params = array()) : string

Get the Ansel_View_Image_Thumb object

Parameters

\Ansel_Gallery $parent

The parent Ansel_Gallery object.

\Ansel_Style $style

A gallery definition to use.

boolean $mini

Force the use of a mini thumbnail?

array $params

Any additional parameters the Ansel_Tile object may need.

Returns

string —

HTML for this image's view tile.

getType()

getType(  $view = 'full') : string

Get the image type for the requested view.

Parameters

$view

Returns

string —

The requested view's mime type

getViewHash()

getViewHash(string  $view, \Ansel_Style  $style = null) : string

Return a hash key for the given view and style.

Parameters

string $view

The view (thumb, prettythumb etc...)

\Ansel_Style $style

The style.

Returns

string —

A md5 hash suitable for use as a key.

getAttributes()

getAttributes() : array

Get the image attributes from the backend.

Returns

array —

A hash of Exif fieldnames => values.

isMultiPage()

isMultiPage() : boolean

Indicates if this image represents a multipage image.

Throws

\Ansel_Exception

Returns

boolean

getImagePageCount()

getImagePageCount() : integer

Get the number of pages that a multipage image contains.

Throws

\Ansel_Exception

Returns

integer —

The number of pages.

rewind()

rewind() : void

Reset the iterator to the first image in the set.

Throws

\Ansel_Exception

current()

current() : \Ansel_Image

Return the current image from the internal iterator.

Returns

\Ansel_Image

key()

key() : integer

Get the index of the internal iterator.

Throws

\Ansel_Exception

Returns

integer

next()

next() : mixed

Advance the iterator

Returns

mixed —

Ansel_Image or false if not valid()

valid()

valid() : boolean

Deterimines if the current iterator item is valid.

Throws

\Ansel_Exception

Returns

boolean

_writeData()

_writeData() : boolean

Writes the current data to vfs, used when creating a new image

Throws

\Ansel_Exception

Returns

boolean

_exifToTags()

_exifToTags(array  $fields = array()) : void

Adds specified EXIF fields to this image's tags.

Called during image upload/creation.

Parameters

array $fields

An array of EXIF fields to import as a tag.

_autoRotate()

_autoRotate(  $orientation) 

Autorotate based on EXIF orientation field. Updates the data in memory only.

Parameters

$orientation

_buildImageObject()

_buildImageObject(\Horde_Image_Base  $image) : \Ansel_Image

Build an Ansel_Image from a given Horde_Image.

Used to wrap iterating the Horde_Image

Parameters

\Horde_Image_Base $image

The Horde_Image

Returns

\Ansel_Image