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 license@zend.com so we can send you a copy immediately.
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:
This helper allows you to specify all configuration options, as well as:

bool
$_createTagFlag= 'true'
true
Details
array
$_defaultOptions= 'array(
'base_url' => null'
Default options
Used when determining what options were passed, and needing to merge them with default options.
array(
'base_url' => null
Details
_mergeBaseUrl(
array $options
)
:
string
Determine whether to use default base URL, or base URL from options
Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
string |

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

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

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

getBaseUrl(
)
:
string
Get 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 |

setDefaultDimensions(
null|int|string $width
=
null, null|int|string $height
=
null
)
:
\Zend_View_Helper_TinySrc
Set 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_TinySrc
Set 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 |