PHP Класс 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.
Автор: Chuck Hagenbuch ([email protected])
Автор: Michael J. Rubinsky ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

doSendfile() публичный статический Метод

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() публичный статический Метод

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() публичный статический Метод

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.
Результат string The javascript code

getBreadCrumbs() публичный статический Метод

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.
Результат string

getDateParameter() публичный статический Метод

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.
Результат array A trimmed down (if necessary) date parts array.

getErrorImage() публичный статический Метод

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'.
Результат string The image path.

getImageFromFile() публичный статический Метод

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.
Результат array The image data of the file as an array

getImageObject() публичный статический Метод

Obtain a Horde_Image object
public static getImageObject ( array $params = [] ) : Horde_Image
$params array Any additional parameters
Результат Horde_Image object

getImageUrl() публичный статический Метод

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
Результат Horde_Url The image path.

getStyleDefinition() публичный статический Метод

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
Результат Ansel_Style The definition of the requested style if it's available, otherwise, the ansel_default style is returned.

getStyleSelect() публичный статический Метод

Build a HTML element.

getUrlFor() публичный статический Метод

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.
Результат Horde_Url The generated URL

initJSVariables() публичный статический Метод

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

isAvailable() публичный статический Метод

Check to see if a particular image manipulation function is available.
public static isAvailable ( string $feature ) : boolean
$feature string The name of the function.
Результат boolean True if the function is available.

point2Deg() публичный статический Метод

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?
Результат string

selectGalleries() публичный статический Метод

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.
Результат string The HTML to display the option list.