View/Helper/TinySrc.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_View
- Subpackage
- Helper
\Zend_View_Helper_TinySrc
Helper for generating urls and/or image tags for use with tinysrc.net
tinysrc.net provides an API for generating scaled, browser device-specific images. In essence, you pass the API the URL to an image on your own server, and tinysrc.net then provides the appropriate image based on the device that accesses it.
Additionally, tinysrc.net allows you to specify additional configuration via the API:
- image size. You may define this as:
- explicit size
- subtractive size (size of screen minus specified number of pixels)
- percentage size (percentage of screen size))
- image format. This will convert the image to the given format; allowed values are "png" or "jpeg". By default, gif images are converted to png.
This helper allows you to specify all configuration options, as well as:
- whether or not to generate the full image tag (or just the URL)
- base url to images (which should include the protocol, server, and optionally port and base path)
- Parent(s)
- \Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
- See
- \global\http://tinysrc.net/
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

string $_closingBracket = null
nullDetails- Type
- string
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$_closingBracket

bool $_createTagFlag = truetrueDetails- Type
- bool

array $_defaultOptions = array('base_url' => null, 'format' => null, 'width' => false, 'height' => false, 'create_tag' => true)Default options
Used when determining what options were passed, and needing to merge them with default options.
array('base_url' => null, 'format' => null, 'width' => false, 'height' => false, 'create_tag' => true)Details- Type
- array

\Zend_View_Interface $view = nullView object
Inherited from: \Zend_View_Helper_Abstract::$$view\Zend_View_Helper_HtmlElement::$$viewnullDetails- Type
- \Zend_View_Interface
- Inherited_from
- \Zend_View_Helper_Abstract::$$view
- Inherited_from
- \Zend_View_Helper_HtmlElement::$$view
Methods

_htmlAttribs(array $attribs) : stringConverts an associative array to a string of tag attributes.
Inherited from: \Zend_View_Helper_HtmlElement::_htmlAttribs()| Name | Type | Description |
|---|---|---|
| $attribs | array | From this array, each key-value pair is converted to an attribute name and value. |
| Type | Description |
|---|---|
| string | The XHTML for the attributes. |
- Access
- public

_mergeBaseUrl(array $options) : stringDetermine whether to use default base URL, or base URL from options
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| string |

_mergeDimensions(array $options) : stringDetermine whether to use default dimensions, or those passed in options.
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| string |

_mergeFormat(array $options) : stringDetermine whether to use default format or format provided in options.
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| string |

_normalizeId(string $value) : string
| Name | Type | Description |
|---|---|---|
| $value | string |
| Type | Description |
|---|---|
| string |

_validateDimension(string $dim) : boolValidate a dimension
Dimensions may be integers, optionally preceded by '-' or 'x'.
| Name | Type | Description |
|---|---|---|
| $dim | string |
| Type | Description |
|---|---|
| bool |

direct() : voidStrategy pattern: currently unutilized
Inherited from: \Zend_View_Helper_Abstract::direct()\Zend_View_Helper_HtmlElement::direct()
getBaseUrl() : stringGet base URL for images
If none already set, uses the ServerUrl and BaseUrl view helpers to determine the base URL to images.
| Type | Description |
|---|---|
| string |

getClosingBracket() : stringGet the tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()| Type | Description |
|---|---|
| string |

setBaseUrl(string $url) : \Zend_View_Helper_TinySrcSet base URL for images
| Name | Type | Description |
|---|---|---|
| $url | string |
| Type | Description |
|---|---|
| \Zend_View_Helper_TinySrc |

setCreateTag(bool $flag) : \Zend_View_Helper_TinySrcSet state of "create tag" flag
| Name | Type | Description |
|---|---|---|
| $flag | bool |
| Type | Description |
|---|---|
| \Zend_View_Helper_TinySrc |

setDefaultDimensions(null | int | string $width = null, null | int | string $height = null) : \Zend_View_Helper_TinySrcSet default dimensions
If null is specified for width, default dimensions will be cleared. If only width is specified, only width will be used. If either dimension fails validation, an exception is raised.
| Name | Type | Description |
|---|---|---|
| $width | null | int | string | |
| $height | null | int | string |
| Type | Description |
|---|---|
| \Zend_View_Helper_TinySrc |
| Exception | Description |
|---|---|
| \Zend_View_Exception |

setDefaultFormat(null | string $format = null) : \Zend_View_Helper_TinySrcSet default image format
If set, this will set the default format to use on all images.
| Name | Type | Description |
|---|---|---|
| $format | null | string |
| Type | Description |
|---|---|
| \Zend_View_Helper_TinySrc |
| Exception | Description |
|---|---|
| \Zend_View_Exception |

setView(\Zend_View_Interface $view) : \Zend_View_Helper_AbstractSet the View object
Inherited from: \Zend_View_Helper_Abstract::setView()\Zend_View_Helper_HtmlElement::setView()| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_View_Helper_Abstract |