PHP Class Ansel, horde

Copyright 2001-2016 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.
Author: Chuck Hagenbuch ([email protected])
Author: Michael J. Rubinsky ([email protected])
Afficher le fichier Open project: horde/horde Class Usage Examples

Méthodes publiques

Méthode Description
doSendfile ( string $filename, string $type ) Send appropriate headers for sendfile support based on server.
downloadImagesAsZip ( Ansel_Gallery $gallery = null, array $images = [] ) Downloads all requested images as a zip file. Assumes all permissions have been checked on the requested resource. Can request either a single gallery of images, OR an array of individual image ids.
embedCode ( array $options ) : string Generate the JS necessary to embed a gallery / images into another external site.
getBreadCrumbs ( Ansel_Gallery $gallery = null, stirng $separator = ' » ' ) : string Generate a list of breadcrumbs showing where we are in the gallery tree.
getDateParameter ( array $date = [] ) : array Get a date parts array containing only enough date parts for the depth we are at. If an empty array is passed, attempt to get the parts from url parametrs. Any missing date parts must be set to 0.
getErrorImage ( string $view = 'screen' ) : string This photo should be used as a placeholder if the correct photo can't be retrieved
getImageFromFile ( string $file, array $override = [] ) : array Read an image from the filesystem.
getImageObject ( array $params = [] ) : Horde_Image Obtain a Horde_Image object
getImageUrl ( string $imageId, string $view = 'screen', boolean $full = false, Ansel_Style $style = null ) : Horde_Url Return a link to an image, suitable for use in an tag Takes into account $conf['vfs']['direct'] and other factors.
getStyleDefinition ( string $style ) : Ansel_Style Get a pre-defined style definition for the requested named style
getStyleSelect ( string $element_name, string $selected = '' ) : string Build a HTML
getTagLinks ( array $tags, string $action = 'add', string $owner = null ) : string Get the URL for a tag search link
getUrlFor ( string $controller, array $data, boolean $full = false, integer $append_session ) : Horde_Url Return a properly formatted link depending on the global pretty url configuration
initJSVariables ( ) Simple helper to output initial Ansel JS.
isAvailable ( string $feature ) : boolean Check to see if a particular image manipulation function is available.
point2Deg ( float $value, boolean $lat = false ) : string Helper function for displaying Lat/Lng values
selectGalleries ( array $params = [] ) : string Return a string containing an

Method Details

doSendfile() public static méthode

Send appropriate headers for sendfile support based on server.
public static doSendfile ( string $filename, string $type )
$filename string The full file path of the file to send.
$type string The MIME type of the file.

downloadImagesAsZip() public static méthode

Downloads all requested images as a zip file. Assumes all permissions have been checked on the requested resource. Can request either a single gallery of images, OR an array of individual image ids.
public static downloadImagesAsZip ( Ansel_Gallery $gallery = null, array $images = [] )
$gallery Ansel_Gallery The galleries to download
$images array The images to download

embedCode() public static méthode

Generate the JS necessary to embed a gallery / images into another external site.
public static embedCode ( array $options ) : string
$options array The options to build the view.
Résultat string The javascript code

getBreadCrumbs() public static méthode

Generate a list of breadcrumbs showing where we are in the gallery tree.
public static getBreadCrumbs ( Ansel_Gallery $gallery = null, stirng $separator = ' » ' ) : string
$gallery Ansel_Gallery The gallery the bread crumbs are for.
$separator stirng The separator text to use between crumbs.
Résultat string

getDateParameter() public static méthode

Get a date parts array containing only enough date parts for the depth we are at. If an empty array is passed, attempt to get the parts from url parametrs. Any missing date parts must be set to 0.
public static getDateParameter ( array $date = [] ) : array
$date array A full date parts array or an empty array.
Résultat array A trimmed down (if necessary) date parts array.

getErrorImage() public static méthode

This photo should be used as a placeholder if the correct photo can't be retrieved
public static getErrorImage ( string $view = 'screen' ) : string
$view string The view ('screen', 'thumb', or 'full') to show. Defaults to 'screen'.
Résultat string The image path.

getImageFromFile() public static méthode

Read an image from the filesystem.
public static getImageFromFile ( string $file, array $override = [] ) : array
$file string The filename of the image.
$override array Overwrite the file array with these values.
Résultat array The image data of the file as an array

getImageObject() public static méthode

Obtain a Horde_Image object
public static getImageObject ( array $params = [] ) : Horde_Image
$params array Any additional parameters
Résultat Horde_Image object

getImageUrl() public static méthode

Return a link to an image, suitable for use in an tag Takes into account $conf['vfs']['direct'] and other factors.
public static getImageUrl ( string $imageId, string $view = 'screen', boolean $full = false, Ansel_Style $style = null ) : Horde_Url
$imageId string The id of the image.
$view string The view ('screen', 'thumb', 'full', 'mini') to show.
$full boolean Return a path that includes the server name?
$style Ansel_Style Use this gallery style
Résultat Horde_Url The image path.

getStyleDefinition() public static méthode

Get a pre-defined style definition for the requested named style
public static getStyleDefinition ( string $style ) : Ansel_Style
$style string The name of the style to fetch
Résultat Ansel_Style The definition of the requested style if it's available, otherwise, the ansel_default style is returned.

getStyleSelect() public static méthode

Build a HTML element.

getUrlFor() public static méthode

Return a properly formatted link depending on the global pretty url configuration
public static getUrlFor ( string $controller, array $data, boolean $full = false, integer $append_session ) : Horde_Url
$controller string The controller to generate a URL for.
$data array The data needed to generate the URL.
$full boolean Generate a full URL.
$append_session integer 0 = only if needed, 1 = always, -1 = never.
Résultat Horde_Url The generated URL

initJSVariables() public static méthode

Simple helper to output initial Ansel JS.
public static initJSVariables ( )

isAvailable() public static méthode

Check to see if a particular image manipulation function is available.
public static isAvailable ( string $feature ) : boolean
$feature string The name of the function.
Résultat boolean True if the function is available.

point2Deg() public static méthode

Helper function for displaying Lat/Lng values
public static point2Deg ( float $value, boolean $lat = false ) : string
$value float The value to convert.
$lat boolean Is this a latitude value?
Résultat string

selectGalleries() public static méthode

Return a string containing an
public static selectGalleries ( array $params = [] ) : string
$params array An array of options:
  (integer)selected  The gallery_id of the gallery that is selected
  (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.
  (boolean)all_levels
  (integer)from      The gallery to start listing at.
  (integer)count     The number of galleries to return.
  (integer)ignore    An Ansel_Gallery id to ignore when building the tree.
Résultat string The HTML to display the option list.