Methods summary
public
array
|
#
browse( string $path = '', array $properties = array() )
Browse through Ansel's gallery tree.
Browse through Ansel's gallery tree.
Parameters
- $path
- The level of the tree to browse.
- $properties
- <p>The item properties to return. Defaults to 'name',
'icon', and 'browseable'.</p>
Returns
array The contents of $path
|
public
array
|
#
put( string $path, string $content, string $content_type )
Saves an image into the gallery tree.
Saves an image into the gallery tree.
Parameters
- $path
- The path where to PUT the file.
- $content
- The file content.
- $content_type
- The file's content type.
Returns
array The event UIDs.
Throws
Horde_Exception_PermissionDenied
Horde_Exception_NotFound
|
public
array
|
#
saveImage( integer $gallery_id, array $image, array $params = array() )
Stores an image in a gallery and returns gallery and image data.
Stores an image in a gallery and returns gallery and image data.
Parameters
- $gallery_id
- The gallery id to add the image to.
- $image
- <p>Image data array. This can either be the
return from Horde_Form_Type_image:: or an
array with the following four fields:
'filename', 'description', 'data', 'type' and
optionally 'tags'</p>
- $params
- An array of additional parameters:
<pre>(string)slug <span class="php-keyword1">If</span> set, <span class="php-keyword1">use</span> this <span class="php-keyword1">as</span> the gallery slug
(ignores <span class="php-var">$gallery_id</span>)
(string)scope The scope to <span class="php-keyword1">use</span>, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>.
(boolean)<span class="php-keyword1">default</span> Set this <span class="php-keyword1">as</span> the <span class="php-keyword2">key</span> gallery image.
(<span class="php-keyword1">array</span>)gallery_data Any gallery parameters to change at this <span class="php-keyword2">time</span>.
(string)encoding The encoding type <span class="php-keyword1">for</span> the image data (base64 <span class="php-keyword1">or</span> binhex)
(string)compression The compression type <span class="php-keyword1">for</span> image data (gzip,lzf)
(boolean)skiphook Don<span class="php-quote">'t call the postupload hook(s).</span></pre>
Returns
array An array of image/gallery data
Throws
InvalidArgumentException
Horde_Exception_PermissionDenied
|
public
|
#
postBatchUpload( array $image_ids )
Notify Ansel that a group of images has just been uploaded. Used for when
the postupload hook should be called with a group of recently
uploaded images, as opposed to calling it once after each image is saved.
Notify Ansel that a group of images has just been uploaded. Used for when
the postupload hook should be called with a group of recently
uploaded images, as opposed to calling it once after each image is saved.
Parameters
- $image_ids
- An array of image ids.
|
public
|
#
removeImage( integer $gallery_id, string $image_id, array $params = array() )
Removes an image from a gallery.
Removes an image from a gallery.
Parameters
- $gallery_id
- The id of gallery.
- $image_id
- The id of image to remove.
- $params
- Additional parameters:
(string)scope The scope to <span class="php-keyword1">use</span>, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>.
Throws
Horde_Exception_PermissionDenied
|
public
integer
|
#
createGallery( array $attributes, array $params = array() )
Add a new gallery to any application scope.
Add a new gallery to any application scope.
Parameters
- $attributes
- The gallery attributes
- $params
- Additional (optional) parameters:
<pre>(string)scope The scope to <span class="php-keyword1">use</span>, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>.
(<span class="php-keyword1">array</span>)perm An <span class="php-keyword1">array</span> of permission data <span class="php-keyword1">if</span> Ansel<span class="php-quote">'s defaults are
not desired. Takes an array like:
array('</span>guest<span class="php-quote">' => Horde_Perms::SHOW | Horde_Perms::READ,
'</span><span class="php-keyword1">default</span><span class="php-quote">' => Horde_Perms::SHOW | Horde_Perms::READ);
(integer)parent The gallery id of the parent gallery, if not a top level gallery.</span></pre>
Returns
integer The gallery id of the new gallery
Throws
Horde_Exception_PermissionDenied
|
public
|
#
removeGallery( integer $gallery_id, array $params = array() )
Removes a gallery and its images.
Removes a gallery and its images.
Parameters
- $gallery_id
- The id of gallery.
- $params
- Any additional, optional, parameters:
(string)scope the scope to <span class="php-keyword1">use</span>, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>
Throws
|
public
integer
|
#
count( integer $gallery_id = null, array $params = array() )
Returns the number of images in a gallery.
Returns the number of images in a gallery.
Parameters
- $gallery_id
- The gallery id.
- $params
- Array of optional parameters:
<pre>(string)scope Scope to <span class="php-keyword1">use</span>, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>.
(string)slug <span class="php-keyword1">If</span> set, ignore gallery_id <span class="php-keyword1">and</span> <span class="php-keyword1">use</span> this <span class="php-keyword1">as</span> the slug.</pre>
Returns
integer The number of images in the gallery.
Throws
|
public
integer
|
#
getGalleryKeyImage( integer $gallery_id, array $params = array() )
Returns the id of the specified gallery's key image.
Returns the id of the specified gallery's key image.
Parameters
- $gallery_id
- The gallery id.
- $params
- Additional parameters:
<pre>(string)scope Application scope, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>
(string)style A named style to <span class="php-keyword1">use</span>, <span class="php-keyword1">if</span> not ansel_default
(string)slug Ignore gallery_id, <span class="php-keyword1">and</span> <span class="php-keyword1">use</span> this <span class="php-keyword1">as</span> the slug</pre>
Returns
integer The key image id.
|
public
string
|
#
getImageUrl( integer $image_id, array $params = array() )
Returns the URL to the specified image.
Returns the URL to the specified image.
Parameters
- $image_id
- The id of the image.
- $params
- Additional optional parameters:
<pre>(string)scope The application scope, <span class="php-keyword1">if</span> not the <span class="php-keyword1">default</span>.
(string)view The image view type to <span class="php-keyword1">return</span> (screen, thumb, etc...)
(string)full <span class="php-keyword1">Return</span> a fully qualified path?
(string)style <span class="php-keyword1">Use</span> this gallery style instead of ansel_default.</pre>
Returns
string The image path.
|
public
string
|
#
getImageContent( integer $image_id, array $params = array() )
Returns raw image data in specified encoding/compression format.
Returns raw image data in specified encoding/compression format.
Parameters
- $image_id
- The id of the image.
- $params
- Optional parameters:
<pre>(string)scope Application scope, <span class="php-keyword1">if</span> not <span class="php-keyword1">default</span>.
(string)view The image view type to <span class="php-keyword1">return</span> (screen, thumb etc...)
(string)style Force the <span class="php-keyword1">use</span> of this gallery style
(string)encoding Encoding type (base64, binhex)
(string)compression Compression type (gzip, lzf)</pre>
Returns
string The raw image data.
Throws
Todo:
See about using a stream
|
public
array
|
#
listGalleries( array $params = array() )
Returns a list of all galleries.
Returns a list of all galleries.
Parameters
- $params
- Optional parameters:
<pre>(string)scope The application scope, <span class="php-keyword1">if</span> not <span class="php-keyword1">default</span>.
(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 gallery information.
|
public
array
|
#
getGalleries( array $ids, string $app = null, array $slugs = array() )
Returns an array of gallery information.
Returns an array of gallery information.
Parameters
- $ids
- An array of gallery ids.
- $app
- Application scope to use, if not the default.
- $slugs
- An array of gallery slugs (ignore $ids).
Returns
array An array of gallery data arrays
|
public
|
#
selectGalleries( array $params = array() )
Returns a 'select' menu from the list of galleries created by
listGalleries().
Returns a 'select' menu from the list of galleries created by
listGalleries().
Parameters
- $params
- Optional parameters:
<pre>(string)scope Application scope, <span class="php-keyword1">if</span> not <span class="php-keyword1">default</span>.
(integer)selected The gallery_id of the gallery that is selected
(integer)perm The permissions filter to <span class="php-keyword1">use</span> [Horde_Perms::SHOW]
(mixed)filter 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.
(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>.
(integer)ignore An Ansel_Gallery id to ignore when building the tree.</pre>
|
public
array
|
#
listImages( integer $gallery_id, array $params = array() )
Returns a list of all images in a gallery.
Returns a list of all images in a gallery.
The return has the URL because in a lot of cases you'll want the url
also. Using api call getImageURL results in a lot of overhead when
e.g. generating a select list.
Parameters
- $gallery_id
- Gallery id to get images from.
- $params
- Additional parameters:
<pre>(string)app Application scope to <span class="php-keyword1">use</span> [ansel].
(string)view View size to generate URLs <span class="php-keyword1">for</span> [thumb].
(boolean)full <span class="php-keyword1">Return</span> a full URL [<span class="php-keyword1">false</span>].
(integer)from Start image.
(integer)limit <span class="php-keyword2">Max</span> <span class="php-keyword2">count</span> of images to <span class="php-keyword1">return</span>.
(string)style <span class="php-keyword1">Use</span> this gallery style.
(string)slug Gallery slug (ignore gallery_id).</pre>
Returns
array Hash of image data (see below) keyed by image_id.
name
caption
type
uploaded
original_date
url
|
public
array
|
#
getRecentImages( array $params = array() )
Return a list of recently added images
Return a list of recently added images
Parameters
- $params
- Parameter (optionally) containing:
<
<p>pre>
(string)app Application used if null then use default.
(array)galleries An array of gallery ids to check. If left empty,
will search all galleries with the given
permissions for the current user.
(string)view The type of image view to return.
(boolean)full Return a full URL if this is true.
(integer)limit The maximum number of images to return.
(string)style Force the use of this gallery style
(array)slugs An array of gallery slugs</p>
Returns
array A hash of image information arrays, keyed by image_id:
See
Ansel_Api::getImages
|
public
integer
|
#
countGalleries( array $params = array() )
Counts the number of galleries.
Counts the number of galleries.
Parameters
- $params
- Parameter array containing the following optional:
<
<p>pre>
(string)app Application scope to use, if not the default.
(integer)perm The level of permissions to require for a gallery
to return it.
(mixed)attributes Restrict the galleries counted to those matching
attributes. An array of attribute/value pairs or
a gallery owner username.
(integer)parent The parent gallery id to start searching at.
(boolean)all_levels Return all levels, or just the direct children of
$parent?</p>
Returns
integer Returns the number of matching galleries.
|
public
array
|
#
listTagInfo( array $tags = null, mixed $user = null )
Retrieve the list of used tag_names, tag_ids and the total number
of resources that are linked to that tag.
Retrieve the list of used tag_names, tag_ids and the total number
of resources that are linked to that tag.
Parameters
- $tags
- <p>An optional array of tag_ids. If omitted, all tags
will be included.</p>
- $user
-
Returns
array An array containing tag_name, and total
|
public
array
|
#
searchTags( array $names, integer $max = 10, integer $from = 0, string $resource_type = '', string $user = null, boolean $raw = false, string $app = 'ansel' )
SearchTags API:
Returns an application-agnostic array (useful for when doing a tag search
across multiple applications)
SearchTags API:
Returns an application-agnostic array (useful for when doing a tag search
across multiple applications)
The 'raw' results array can be returned instead by setting $raw = true.
Parameters
- $names
- An array of tag_names to search for.
- $max
- The maximum number of resources to return.
- $from
- The number of the resource to start with.
- $resource_type
- The resource type [gallery, image, '']
- $user
- Restrict results to resources owned by $user.
- $raw
- Return the raw data?
- $app
- Application scope to use, if not the default.
Returns
array An array of results:
'title' - The title for this resource.
'desc' - A terse description of this resource.
'view_url' - The URL to view this resource.
'app' - The Horde application this resource belongs to.
|
public
boolean
|
#
galleryExists( integer $gallery_id, string $slug = '', string $app = null )
Checks if the gallery exists
Checks if the gallery exists
Parameters
- $gallery_id
- The gallery id
- $slug
- The gallery slug
- $app
- Application scope to use, if not the default.
Returns
boolean
|
public
hash
|
#
getGalleryStyles( )
Get a list of all pre-configured styles.
Get a list of all pre-configured styles.
Returns
hash of style definitions.
|
public
array
|
#
renderView( array $params = array(), string $app = null, string $view = 'Gallery' )
Renders a gallery view
Parameters
- $params
- Any parameters that the view might need.
- $app
- Application scope to use, if not the default.
- $view
- <p>The generic type of view we want.
(Gallery, Image, List, Embedded)</p>
Returns
array An array containing 'html' and 'crumbs' keys.
See
Ansel_View_* classes for descriptions of
available parameters to use here.
|