Overview

Packages

  • Ansel
  • None

Classes

  • Ansel
  • Ansel_Ajax_Application
  • Ansel_Ajax_Imple_EditCaption
  • Ansel_Ajax_Imple_EditFaces
  • Ansel_Ajax_Imple_EditGalleryFaces
  • Ansel_Ajax_Imple_Embed
  • Ansel_Ajax_Imple_GallerySlugCheck
  • Ansel_Ajax_Imple_ImageSaveGeotag
  • Ansel_Ajax_Imple_LocationAutoCompleter
  • Ansel_Ajax_Imple_MapLayerSelect
  • Ansel_Ajax_Imple_TagActions
  • Ansel_Ajax_Imple_ToggleGalleryActions
  • Ansel_Ajax_Imple_ToggleOtherGalleries
  • Ansel_Ajax_Imple_UploadNotification
  • Ansel_Api
  • Ansel_Exception
  • Ansel_Faces
  • Ansel_Faces_Base
  • Ansel_Faces_Facedetect
  • Ansel_Faces_User
  • Ansel_Factory_Faces
  • Ansel_Factory_Storage
  • Ansel_Factory_Styles
  • Ansel_Form_Ecard
  • Ansel_Form_Image
  • Ansel_Form_ImageDate
  • Ansel_Form_Upload
  • Ansel_Gallery
  • Ansel_Gallery_Decorator_Date
  • Ansel_GalleryMode_Base
  • Ansel_GalleryMode_Date
  • Ansel_GalleryMode_Normal
  • Ansel_Image
  • Ansel_ImageGenerator
  • Ansel_ImageGenerator_Mini
  • Ansel_ImageGenerator_PolaroidThumb
  • Ansel_ImageGenerator_PolaroidThumbStack
  • Ansel_ImageGenerator_RoundedThumb
  • Ansel_ImageGenerator_RoundedThumbStack
  • Ansel_ImageGenerator_Screen
  • Ansel_ImageGenerator_ShadowThumb
  • Ansel_ImageGenerator_ShadowThumbStack
  • Ansel_ImageGenerator_SquareThumb
  • Ansel_ImageGenerator_Thumb
  • Ansel_LoginTasks_SystemTask_Upgrade
  • Ansel_Report
  • Ansel_Report_letter
  • Ansel_Report_mail
  • Ansel_Report_tickets
  • Ansel_Search
  • Ansel_Search_exif
  • Ansel_Search_Tag
  • Ansel_Storage
  • Ansel_Style
  • Ansel_Tagger
  • Ansel_Test
  • Ansel_Tile_DateGallery
  • Ansel_Tile_Gallery
  • Ansel_Tile_Image
  • Ansel_View_Ansel
  • Ansel_View_Base
  • Ansel_View_EmbeddedRenderer_GalleryLink
  • Ansel_View_EmbeddedRenderer_Mini
  • Ansel_View_EmbeddedRenderer_Slideshow
  • Ansel_View_Gallery
  • Ansel_View_GalleryProperties
  • Ansel_View_GalleryRenderer_Base
  • Ansel_View_GalleryRenderer_Gallery
  • Ansel_View_GalleryRenderer_GalleryLightbox
  • Ansel_View_Image
  • Ansel_View_List
  • Ansel_View_Results
  • Ansel_View_Slideshow
  • Ansel_View_Upload
  • Ansel_Widget
  • Ansel_Widget_Actions
  • Ansel_Widget_Base
  • Ansel_Widget_GalleryFaces
  • Ansel_Widget_Geotag
  • Ansel_Widget_ImageFaces
  • Ansel_Widget_Links
  • Ansel_Widget_OtherGalleries
  • Ansel_Widget_OwnerFaces
  • Ansel_Widget_SimilarPhotos
  • Ansel_Widget_Tags
  • Ansel_XPPublisher
  • Overview
  • Package
  • Class
  • Tree

Class Ansel_Storage

Class for interfacing with back end data storage.

Copyright 2001-2012 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.

Package: Ansel
Author: Michael J. Rubinsky mrubinsk@horde.org
Located at Storage.php
Methods summary
public Ansel_Storage
# __construct( Horde_Core_Share_Driver $shareOb )

Const'r

Const'r

Parameters

$shareOb
share object

Returns

Ansel_Storage
public
# __get( string $property )

Property accessor

Property accessor

Parameters

$property
The property to access.
public
# setStorage( mixed $storage )

Backend setter

Backend setter

Parameters

$storage
The backend storage driver.
public Ansel_Gallery
# createGallery( array $attributes = array(), Horde_Perms_Permission $perm = null, integer $parent = null )

Create and initialise a new gallery object.

Create and initialise a new gallery object.

Parameters

$attributes
The gallery attributes.
$perm
<p>The permissions for the gallery if the defaults are not desirable.</p>
$parent
The id of the parent gallery (if any)

Returns

Ansel_Gallery
A new gallery object.

Throws

Ansel_Exception
public Ansel_Gallery
# getGalleryBySlug( string $slug, array $overrides = array() )

Retrieve an Ansel_Gallery given the gallery's slug

Retrieve an Ansel_Gallery given the gallery's slug

Parameters

$slug
The gallery slug
$overrides
<p>An array of attributes that should be overridden when the gallery is returned.</p>

Returns

Ansel_Gallery
The gallery object

Throws

Horde_Exception_NotFound
public Ansel_Gallery
# getGallery( integer $gallery_id, array $overrides = array() )

Retrieve an Ansel_Gallery given the share id

Retrieve an Ansel_Gallery given the share id

Parameters

$gallery_id
The gallery_id to fetch
$overrides
<p>An array of attributes that should be overridden when the gallery is returned.</p>

Returns

Ansel_Gallery

Throws

Ansel_Exception
public array
# getGalleriesBySlugs( array $slugs, mixed $perms = Horde_Perms::SHOW )

Retrieve an array of Ansel_Gallery objects for the given slugs.

Retrieve an array of Ansel_Gallery objects for the given slugs.

Parameters

$slugs
The gallery slugs.
$perms

Returns

array
An array of Ansel_Gallery objects.

Throws

Ansel_Exception
public array
# getGalleries( array $ids, integer $perms = Horde_Perms::SHOW )

Retrieve an array of Ansel_Gallery objects for the requested ids

Retrieve an array of Ansel_Gallery objects for the requested ids

Parameters

$ids
Gallery ids to fetch
$perms
Horde_Perms constant for the perms required.

Returns

array
An array of Ansel_Gallery objects

Throws

Ansel_Exception
public
# emptyGallery( Ansel_Gallery $gallery )

Empties a gallery of all images.

Empties a gallery of all images.

Parameters

$gallery
The ansel gallery to empty.

Throws

Ansel_Exception
public
# removeGallery( Ansel_Gallery $gallery )

Removes an Ansel_Gallery.

Removes an Ansel_Gallery.

Parameters

$gallery
The gallery to delete

Throws

Ansel_Exception
public Ansel_Image &
# getImage( integer $id )

Returns the image corresponding to the given id.

Returns the image corresponding to the given id.

Parameters

$id
The image_id of the image to retrieve.

Returns

Ansel_Image
The image object requested..

Throws

Ansel_Exception,
Horde_Exception_NotFound
public integer
# saveImage( Ansel_Image $image )

Save image details to storage. Does NOT update the cached image files.

Save image details to storage. Does NOT update the cached image files.

Parameters

$image
The image to save.

Returns

integer
The image id

Throws

Ansel_Exception
public
# saveImageAttribute( integer $image_id, string $attribute, string $value )

Store an image attribute to storage

Store an image attribute to storage

Parameters

$image_id
The image id
$attribute
$attributes The attribute name
$value
The attrbute value

Throws

Ansel_Exception
public
# clearImageAttributes( integer $image_id )

Clears an image's attributes from storage.

Clears an image's attributes from storage.

Parameters

$image_id
The image to clear

Throws

Ansel_Exception
public array
# getImageAttributes( integer $image_id )

Get image's attribtues from storage

Get image's attribtues from storage

Parameters

$image_id
The image id

Returns

array
A image attribute hash

Throws

Horde_Exception
public
# setImageSortOrder( integer $imageId, integer $pos )

Set image sort order

Set image sort order

Parameters

$imageId
The image id
$pos
The new sort order position

Throws

Ansel_Exception
public array
# getImages( array $params = array() )

Return the images corresponding to the given ids.

Return the images corresponding to the given ids.

Parameters

$params
function parameters: <pre><span class="php-quote">'ids'</span> - An <span class="php-keyword1">array</span> of image ids to fetch. <span class="php-quote">'preserve'</span> - Preserve the order of the image ids when returned. <span class="php-quote">'gallery_id'</span> - <span class="php-keyword1">Return</span> all images from requested gallery (ignores <span class="php-quote">'ids'</span>). <span class="php-quote">'from'</span> - <span class="php-keyword1">If</span> passing a gallery, start at this image. <span class="php-quote">'count'</span> - <span class="php-keyword1">If</span> passing a gallery, <span class="php-keyword1">return</span> this many images.</pre>

Returns

array
An array of Ansel_Image objects.

Throws

Ansel_Exception,
Horde_Exception_NotFound, InvalidArgumentException
public array
# getRecentImages( array $galleries = array(), integer $limit = 10, array $slugs = array() )

Returns a list of Ansel_Images of the most recently added images for the current user.

Returns a list of Ansel_Images of the most recently added images for the current user.

Parameters

$galleries
<p>An array of gallery ids to search in. If left empty, will search all galleries with Horde_Perms::SHOW.</p>
$limit
The maximum number of images to return
$slugs
An array of gallery slugs.

Returns

array
An array of Ansel_Image objects

Throws

Ansel_Exception
public boolean
# galleryExists( integer $gallery_id = null, string $slug = null )

Check if a gallery exists. Need to do this here so we can also check by gallery slug.

Check if a gallery exists. Need to do this here so we can also check by gallery slug.

Parameters

$gallery_id
The gallery id
$slug
The gallery slug

Returns

boolean

Throws

Ansel_Exception
public integer
# countGalleries( string $userid, array $params = array() )

Return the count of galleries that the user has specified permissions to and that match any of the requested attributes.

Return the count of galleries that the user has specified permissions to and that match any of the requested attributes.

Parameters

$userid
The user to check access for.
$params
Parameter array: <pre>(integer)perm The level of permissions to <span class="php-keyword1">require</span> <span class="php-keyword1">for</span> a gallery to <span class="php-keyword1">return</span> it [Horde_Perms::SHOW] (mixed)attributes Restrict the galleries counted to those matching <span class="php-var">$attributes</span>. An <span class="php-keyword1">array</span> of attribute/values pairs <span class="php-keyword1">or</span> a gallery owner username. (Ansel_Gallery)parent The parent share to start counting at. (boolean)all_levels <span class="php-keyword1">Return</span> all levels, <span class="php-keyword1">or</span> just the direct children of <span class="php-var">$parent</span>? [<span class="php-keyword1">true</span>] (<span class="php-keyword1">array</span>)tags Filter results by galleries tagged with tags.</pre>

Returns

integer
The count

Throws

Ansel_Exception
public array
# listGalleries( array $params = array() )

Retrieves the current user's gallery list from storage.

Retrieves the current user's gallery list from storage.

Parameters

$params
Optional parameters: <pre>(integer)perm The permissions filter to <span class="php-keyword1">use</span> [Horde_Perms::SHOW] (mixed)attributes Restrict the galleries returned to those matching the filters. Can be an <span class="php-keyword1">array</span> of attribute/values pairs <span class="php-keyword1">or</span> a gallery owner username. (integer)parent The parent share to start listing at. (boolean)all_levels <span class="php-keyword1">If</span> set, <span class="php-keyword1">return</span> all levels below parent, not just direct children [<span class="php-keyword1">TRUE</span>] (integer)from The gallery to start listing at. (integer)<span class="php-keyword2">count</span> The number of galleries to <span class="php-keyword1">return</span>. (string)sort_by Attribute to <span class="php-keyword2">sort</span> by. (integer)direction The direction to <span class="php-keyword2">sort</span> by [Ansel::SORT_ASCENDING] (<span class="php-keyword1">array</span>)tags An <span class="php-keyword1">array</span> of tags to limit results by.</pre>

Returns

array
An array of Ansel_Gallery objects

Throws

Ansel_Exception
public array
# listAllGalleries( )

Returns a list of ALL galleries, regardless of permissions.

Returns a list of ALL galleries, regardless of permissions.

Returns

array
public string
# getImageJson( array $images, Ansel_Style $style = null, boolean $full = false, string $image_view = 'mini', boolean $view_links = false )

Retrieve json data for an arbitrary list of image ids, not necessarily from the same gallery.

Retrieve json data for an arbitrary list of image ids, not necessarily from the same gallery.

Parameters

$images
An array of image ids
$style
<p>A gallery style to force if requesting pretty thumbs.</p>
$full
Generate full urls
$image_view
Which image view to use? screen, thumb etc..
$view_links
Include links to the image view

Returns

string
The json data
public
# getRandomGallery( array $params = array() )

Returns a random Ansel_Gallery from a list fitting the search criteria.

Returns a random Ansel_Gallery from a list fitting the search criteria.

See

Ansel_Storage::listGalleries()
public array
# listImages( array $params = array() )

Lists a slice of the image ids in the given gallery.

Lists a slice of the image ids in the given gallery.

Parameters

$params
Filter parameters. <pre>integer|<span class="php-keyword1">array</span> <span class="php-quote">'gallery_id'</span> - A gallery id to <span class="php-keyword1">list</span> images from integer <span class="php-quote">'offset'</span> - The image to start listing from integer <span class="php-quote">'limit'</span> - How many images to <span class="php-keyword1">return</span> <span class="php-keyword1">array</span>|string <span class="php-quote">'fields'</span> - The fields to <span class="php-keyword1">return</span> string <span class="php-quote">'sort'</span> - The field to <span class="php-keyword2">sort</span> by. <span class="php-keyword1">array</span> <span class="php-quote">'filter'</span> - Additional filters. <span class="php-keyword2">Each</span> element is an <span class="php-keyword1">array</span> containing <span class="php-quote">'property'</span>, <span class="php-quote">'op'</span>, <span class="php-keyword1">and</span> <span class="php-quote">'value'</span> keys. Passing <span class="php-quote">'IN'</span> <span class="php-keyword1">as</span> the <span class="php-quote">'op'</span> <span class="php-keyword1">and</span> an <span class="php-keyword1">array</span> <span class="php-keyword1">as</span> <span class="php-quote">'value'</span> will produce a SQL IN conditional.</pre>

Returns

array

An array of images. Either an array of ids, or an array of field values, keyed by id.

Throws

Ansel_Exception,
InvalidArgumentException
public array
# getImagesGeodata( array $image_ids = array(), integer $gallery = null )

Return images' geolocation data.

Return images' geolocation data.

Parameters

$image_ids
An array of image_ids to look up.
$gallery
<p>A gallery id. If this is provided, will return all images in the gallery that have geolocation data ($image_ids would be ignored).</p>

Returns

array
of geodata
public array
# getRecentImagesGeodata( string $user = null, integer $start = 0, integer $count = 8 )

Like getRecentImages, but returns geotag data for the most recently added images from the current user. Useful for providing images to help locate images at the same place.

Like getRecentImages, but returns geotag data for the most recently added images from the current user. Useful for providing images to help locate images at the same place.

Parameters

$user
Limit images to this user
$start
Start a slice at this image number
$count
Include this many images

Returns

array
An array of image ids
public array
# searchLocations( string $search = '' )

Search for a textual location string from the passed in search token. Used for location autocompletion.

Search for a textual location string from the passed in search token. Used for location autocompletion.

Parameters

$search
Search fragment for autocompleting location strings

Returns

array
The results

Throws

Ansel_Exception
public
# setImagesGallery( array $image_ids, integer $gallery_id )

Set the gallery id for a set of images. Useful for bulk updating images when moving from one gallery to another.

Set the gallery id for a set of images. Useful for bulk updating images when moving from one gallery to another.

Parameters

$image_ids
An array of image ids
$gallery_id
The gallery id to move the images to.

Throws

Ansel_Exception
public
# removeImage( integer $image_id )

Deletes an Ansel_Image from data storage.

Deletes an Ansel_Image from data storage.

Parameters

$image_id
The image id(s) to remove.

Throws

Ansel_Exception
public
# ensureHash( string $hash )

Ensure the style hash is recorded in the database.

Ensure the style hash is recorded in the database.

Parameters

$hash
The hash to record.
public array
# getHashes( )

Get a list of all known styleHashes.

Get a list of all known styleHashes.

Returns

array
An array of style hashes.
public Ansel_Gallery
# buildGallery( Horde_Share_Object $share )

Build a single Ansel_Gallery object from a Horde_Share_Object

Build a single Ansel_Gallery object from a Horde_Share_Object

Parameters

$share
The share

Returns

Ansel_Gallery
public array
# buildGalleries( array $shares )

Build an array of Ansel_Gallery objects from an array of Horde_Share_Object objects.

Build an array of Ansel_Gallery objects from an array of Horde_Share_Object objects.

Parameters

$shares
An array of Horde_Share_Object objects.

Returns

array
Ansel_Gallery objects.
API documentation generated by ApiGen