Methods summary
public
Ansel_Storage
|
#
__construct( Horde_Core_Share_Driver $shareOb )
Const'r
Parameters
Returns
|
public
|
#
__get( string $property )
Property accessor
Parameters
- $property
- The property to access.
|
public
|
#
setStorage( mixed $storage )
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
Throws
|
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
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
Throws
|
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
|
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
|
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
|
public
|
#
removeGallery( Ansel_Gallery $gallery )
Removes an Ansel_Gallery.
Removes an Ansel_Gallery.
Parameters
- $gallery
- The gallery to delete
Throws
|
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
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
|
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
|
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
|
public
array
|
#
getImageAttributes( integer $image_id )
Get image's attribtues from storage
Get image's attribtues from storage
Parameters
Returns
array A image attribute hash
Throws
Horde_Exception
|
public
|
#
setImageSortOrder( integer $imageId, integer $pos )
Set image sort order
Parameters
- $imageId
- The image id
- $pos
- The new sort order position
Throws
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
Returns
|
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.
|