Property | Type | Description | |
---|---|---|---|
$_db | Horde_Db_Adapter | database handle | |
$_images | array | Local cache of retrieved images | |
$_shares | Horde_Share | The Horde_Shares object to use for this scope. |
Method | Description | |
---|---|---|
__construct ( Horde_Core_Share_Driver $shareOb ) : Ansel_Storage | Const'r | |
__get ( string $property ) | Property accessor | |
buildGalleries ( array $shares ) : array | Build an array of Ansel_Gallery objects from an array of Horde_Share_Object objects. | |
buildGallery ( Horde_Share_Object $share ) : Ansel_Gallery | Build a single Ansel_Gallery object from a Horde_Share_Object | |
clearImageAttributes ( integer $image_id ) | Clears an image's attributes from storage. | |
countGalleries ( $userid, array $params = [] ) : integer | Return the count of galleries that the user has specified permissions to and that match any of the requested attributes. | |
createGallery ( array $attributes = [], Horde_Perms_Permission $perm = null, integer $parent = null ) : Ansel_Gallery | Create and initialise a new gallery object. | |
emptyGallery ( Ansel_Gallery $gallery ) | Empties a gallery of all images. | |
ensureHash ( string $hash ) | Ensure the style hash is recorded in the database. | |
galleryExists ( integer $gallery_id = null, string $slug = null ) : boolean | Check if a gallery exists. Need to do this here so we can also check by gallery slug. | |
getGalleries ( array $ids, integer $perms = Horde_Perms::SHOW ) : array | Retrieve an array of Ansel_Gallery objects for the requested ids | |
getGalleriesBySlugs ( array $slugs, $perms = Horde_Perms::SHOW ) : array | Retrieve an array of Ansel_Gallery objects for the given slugs. | |
getGallery ( integer $gallery_id, array $overrides = [] ) : Ansel_Gallery | Retrieve an Ansel_Gallery given the share id | |
getGalleryBySlug ( string $slug, array $overrides = [] ) : Ansel_Gallery | Retrieve an Ansel_Gallery given the gallery's slug | |
getHashes ( ) : array | Get a list of all known styleHashes. | |
getImage ( integer $id ) : Ansel_Image | Returns the image corresponding to the given id. | |
getImageAttributes ( integer $image_id ) : array | Get image's attribtues from storage | |
getImageJson ( array $images, Ansel_Style $style = null, boolean $full = false, string $image_view = 'mini', boolean $view_links = false ) : string | Retrieve json data for an arbitrary list of image ids, not necessarily from the same gallery. | |
getImages ( array $params = [] ) : array | Return the images corresponding to the given ids. | |
getImagesGeodata ( array $image_ids = [], integer $gallery = null ) : array | Return images' geolocation data. | |
getRandomGallery ( array $params = [] ) | Returns a random Ansel_Gallery from a list fitting the search criteria. | |
getRecentImages ( array $galleries = [], integer $limit = 10, array $slugs = [] ) : array | Returns a list of Ansel_Images of the most recently added images for the current user. | |
getRecentImagesGeodata ( string $user = null, integer $start, integer $count = 8 ) : array | 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. | |
listAllGalleries ( ) : array | Returns a list of ALL galleries, regardless of permissions. | |
listGalleries ( array $params = [] ) : array | Retrieves the current user's gallery list from storage. | |
listImages ( array $params = [] ) : array | Lists a slice of the image ids in the given gallery. | |
removeGallery ( Ansel_Gallery $gallery ) | Removes an Ansel_Gallery. | |
removeImage ( integer $image_id ) | Deletes an Ansel_Image from data storage. | |
saveImage ( Ansel_Image $image ) : integer | Save image details to storage. Does NOT update the cached image files. | |
saveImageAttribute ( integer $image_id, $attribute, string $value ) | Store an image attribute to storage | |
searchLocations ( string $search = '' ) : array | Search for a textual location string from the passed in search token. | |
setImageSortOrder ( integer $imageId, integer $pos ) | Set image sort order | |
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. | |
setStorage ( mixed $storage ) | Backend setter |
Method | Description | |
---|---|---|
_getImageCommentCounts ( array $ids ) : array | Get the total number of comments for an image. | |
_getImageFields ( $alias = '' ) : string | Helper function to get a string of field names | |
_toImageDriverName ( string $field ) : string | Convert an Ansel_Image property to it's backend storage field name. |
public __construct ( Horde_Core_Share_Driver $shareOb ) : Ansel_Storage | ||
$shareOb | Horde_Core_Share_Driver | |
return | Ansel_Storage |
protected _getImageCommentCounts ( array $ids ) : array | ||
$ids | array | Array of image ids |
return | array | of results. @see forums/numMessagesBatch api call |
protected _getImageFields ( $alias = '' ) : string | ||
return | string |
protected _toImageDriverName ( string $field ) : string | ||
$field | string | The field name |
return | string | The converted field name suitable for use in backend. |
public buildGalleries ( array $shares ) : array | ||
$shares | array | An array of Horde_Share_Object objects. |
return | array | Ansel_Gallery objects. |
public buildGallery ( Horde_Share_Object $share ) : Ansel_Gallery | ||
$share | Horde_Share_Object | The share |
return | Ansel_Gallery |
public clearImageAttributes ( integer $image_id ) | ||
$image_id | integer | The image to clear |
public countGalleries ( $userid, array $params = [] ) : integer | ||
$params | array | Parameter array:
(integer)perm The level of permissions to require for a gallery to return it [Horde_Perms::SHOW] (mixed)attributes Restrict the galleries counted to those matching $attributes. An array of attribute/values pairs or a gallery owner username. (Ansel_Gallery)parent The parent share to start counting at. (boolean)all_levels Return all levels, or just the direct children of $parent? [true] (array)tags Filter results by galleries tagged with tags. |
return | integer | The count |
public createGallery ( array $attributes = [], Horde_Perms_Permission $perm = null, integer $parent = null ) : Ansel_Gallery | ||
$attributes | array | The gallery attributes. |
$perm | Horde_Perms_Permission | The permissions for the gallery if the defaults are not desirable. |
$parent | integer | The id of the parent gallery (if any) |
return | Ansel_Gallery | A new gallery object. |
public emptyGallery ( Ansel_Gallery $gallery ) | ||
$gallery | Ansel_Gallery | The ansel gallery to empty. |
public ensureHash ( string $hash ) | ||
$hash | string | The hash to record. |
public getGalleriesBySlugs ( array $slugs, $perms = Horde_Perms::SHOW ) : array | ||
$slugs | array | The gallery slugs. |
return | array | An array of Ansel_Gallery objects. |
public getGallery ( integer $gallery_id, array $overrides = [] ) : Ansel_Gallery | ||
$gallery_id | integer | The gallery_id to fetch |
$overrides | array | An array of attributes that should be overridden when the gallery is returned. |
return | Ansel_Gallery |
public getGalleryBySlug ( string $slug, array $overrides = [] ) : Ansel_Gallery | ||
$slug | string | The gallery slug |
$overrides | array | An array of attributes that should be overridden when the gallery is returned. |
return | Ansel_Gallery | The gallery object |
public getImageAttributes ( integer $image_id ) : array | ||
$image_id | integer | The image id |
return | array | A image attribute hash |
public getImageJson ( array $images, Ansel_Style $style = null, boolean $full = false, string $image_view = 'mini', boolean $view_links = false ) : string | ||
$images | array | An array of image ids |
$style | Ansel_Style | A gallery style to force if requesting pretty thumbs. |
$full | boolean | Generate full urls |
$image_view | string | Which image view to use? screen, thumb etc.. |
$view_links | boolean | Include links to the image view |
return | string | The json data |
public getImages ( array $params = [] ) : array | ||
$params | array | function parameters:
'ids' - An array of image ids to fetch. 'preserve' - Preserve the order of the image ids when returned. 'gallery_id' - Return all images from requested gallery (ignores 'ids'). 'from' - If passing a gallery, start at this image. 'count' - If passing a gallery, return this many images. |
return | array | An array of Ansel_Image objects. |
public getImagesGeodata ( array $image_ids = [], integer $gallery = null ) : array | ||
$image_ids | array | An array of image_ids to look up. |
$gallery | integer | A gallery id. If this is provided, will return all images in the gallery that have geolocation data ($image_ids would be ignored). |
return | array | of geodata |
public getRandomGallery ( array $params = [] ) | ||
$params | array |
public getRecentImages ( array $galleries = [], integer $limit = 10, array $slugs = [] ) : array | ||
$galleries | array | An array of gallery ids to search in. If left empty, will search all galleries with Horde_Perms::SHOW. |
$limit | integer | The maximum number of images to return |
$slugs | array | An array of gallery slugs. |
return | array | An array of Ansel_Image objects |
public listAllGalleries ( ) : array | ||
return | array |
public listGalleries ( array $params = [] ) : array | ||
$params | array | Optional parameters:
(integer)perm The permissions filter to use [Horde_Perms::SHOW] (mixed)attributes Restrict the galleries returned to those matching the filters. Can be an array of attribute/values pairs or a gallery owner username. (integer)parent The parent share to start listing at. (boolean)all_levels If set, return all levels below parent, not just direct children [TRUE] (integer)from The gallery to start listing at. (integer)count The number of galleries to return. (string)sort_by Attribute to sort by. (integer)direction The direction to sort by [Ansel::SORT_ASCENDING] (array)tags An array of tags to limit results by. |
return | array | An array of Ansel_Gallery objects |
public listImages ( array $params = [] ) : array | ||
$params | array | Filter parameters.
integer|array 'gallery_id' - A gallery id to list images from integer 'offset' - The image to start listing from integer 'limit' - How many images to return array|string 'fields' - The fields to return string 'sort' - The field to sort by. array 'filter' - Additional filters. Each element is an array containing 'property', 'op', and 'value' keys. Passing 'IN' as the 'op' and an array as 'value' will produce a SQL IN conditional. |
return | array | An array of images. Either an array of ids, or an array of field values, keyed by id. |
public removeGallery ( Ansel_Gallery $gallery ) | ||
$gallery | Ansel_Gallery | The gallery to delete |
public removeImage ( integer $image_id ) | ||
$image_id | integer | The image id(s) to remove. |
public saveImageAttribute ( integer $image_id, $attribute, string $value ) | ||
$image_id | integer | The image id |
$value | string | The attrbute value |
public searchLocations ( string $search = '' ) : array | ||
$search | string | Search fragment for autocompleting location strings |
return | array | The results |
public setImageSortOrder ( integer $imageId, integer $pos ) | ||
$imageId | integer | The image id |
$pos | integer | The new sort order position |
public setImagesGallery ( array $image_ids, integer $gallery_id ) | ||
$image_ids | array | An array of image ids |
$gallery_id | integer | The gallery id to move the images to. |
public setStorage ( mixed $storage ) | ||
$storage | mixed | The backend storage driver. |