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_Api

Ansel external API interface.

Copyright 2004-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.

Horde_Registry_Api
Extended by Ansel_Api
Package: Ansel
Author: Jan Schneider jan@horde.org
Author: Chuck Hagenbuch chuck@horde.org
Author: Michael J. Rubinsky mrubinsk@horde.org
Located at Api.php
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 mixed
# commentCallback( integer $image_id )

Callback for Agora comments.

Callback for Agora comments.

Parameters

$image_id
Image id to check

Returns

mixed
Image filename on success | false on failure
public boolean
# hasComments( )

Checks if applications allows comments

Checks if applications allows comments

Returns

boolean
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">' =&gt; Horde_Perms::SHOW | Horde_Perms::READ, '</span><span class="php-keyword1">default</span><span class="php-quote">' =&gt; 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

Ansel_Exception
Horde_Exception_PermissionDenied
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

Ansel_Exception
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

Horde_Exception_Permission_Denied
Ansel_Exception

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: &lt; <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: &lt; <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

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.


API documentation generated by ApiGen