View/Helper/TinySrc.php

Show: PublicProtectedPrivateinherited
Table of Contents
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.

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

Package: Zend\View\Helper
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

>VConstant  TINYSRC_BASE = 'http://i.tinysrc.mobi'
>VConstant  EOL = "\n"
inherited
EOL character
Inherited from: \Zend_View_Helper_HtmlElement::EOL

Properties

>VPropertyprotectedstring $_baseUrl

Base URL for images

Details
Type
string
>VPropertyprotectedstring $_closingBracket = null
inherited
The tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::$$_closingBracket
Default valuenullDetails
Type
string
Inherited_from
\Zend_View_Helper_HtmlElement::$$_closingBracket  
>VPropertyprotectedbool $_createTagFlag = true

Whether or not to create an image tag

Default valuetrueDetails
Type
bool
>VPropertyprotectedarray $_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.

Default valuearray('base_url' => null, 'format' => null, 'width' => false, 'height' => false, 'create_tag' => true)Details
Type
array
>VPropertyprotectedstring $_dimensions = ''

Default width and height

Default value''Details
Type
string
>VPropertyprotectedstring $_format = ''

Default image format to use

Default value''Details
Type
string
>VPropertypublic\Zend_View_Interface $view = null
Default valuenullDetails
Type
\Zend_View_Interface
Inherited_from
\Zend_View_Helper_Abstract::$$view  
Inherited_from
\Zend_View_Helper_HtmlElement::$$view  

Methods

methodprotected_htmlAttribs(array $attribs) : string
inherited

Converts an associative array to a string of tag attributes.

Inherited from: \Zend_View_Helper_HtmlElement::_htmlAttribs()
Parameters
NameTypeDescription
$attribsarray

From this array, each key-value pair is converted to an attribute name and value.

Returns
TypeDescription
stringThe XHTML for the attributes.
Details
Access
public  
methodprotected_isStrictDoctype() : boolean
inherited

Is doctype strict?

Inherited from: \Zend_View_Helper_HtmlElement::_isStrictDoctype()
Returns
TypeDescription
boolean
methodprotected_isXhtml() : boolean
inherited

Is doctype XHTML?

Inherited from: \Zend_View_Helper_HtmlElement::_isXhtml()
Returns
TypeDescription
boolean
methodprotected_mergeBaseUrl(array $options) : string

Determine whether to use default base URL, or base URL from options

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
string
methodprotected_mergeDimensions(array $options) : string

Determine whether to use default dimensions, or those passed in options.

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
string
methodprotected_mergeFormat(array $options) : string

Determine whether to use default format or format provided in options.

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
string
methodprotected_normalizeId(string $value) : string
inherited

Normalize an ID

Inherited from: \Zend_View_Helper_HtmlElement::_normalizeId()
Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
string
methodprotected_validateDimension(string $dim) : bool

Validate a dimension

Dimensions may be integers, optionally preceded by '-' or 'x'.

Parameters
NameTypeDescription
$dimstring
Returns
TypeDescription
bool
methodpubliccreateTag() : bool

Should the helper create an image tag?

Returns
TypeDescription
bool
methodpublicdirect() : void
inherited

Strategy pattern: currently unutilized

Inherited from: \Zend_View_Helper_Abstract::direct()\Zend_View_Helper_HtmlElement::direct()
methodpublicgetBaseUrl() : string

Get base URL for images

If none already set, uses the ServerUrl and BaseUrl view helpers to determine the base URL to images.

Returns
TypeDescription
string
methodpublicgetClosingBracket() : string
inherited

Get the tag closing bracket

Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()
Returns
TypeDescription
string
methodpublicsetBaseUrl(string $url) : \Zend_View_Helper_TinySrc

Set base URL for images

Parameters
NameTypeDescription
$urlstring
Returns
TypeDescription
\Zend_View_Helper_TinySrc
methodpublicsetCreateTag(bool $flag) : \Zend_View_Helper_TinySrc

Set state of "create tag" flag

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_View_Helper_TinySrc
methodpublicsetDefaultDimensions(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.

Parameters
NameTypeDescription
$widthnull | int | string
$heightnull | int | string
Returns
TypeDescription
\Zend_View_Helper_TinySrc
Throws
ExceptionDescription
\Zend_View_Exception
methodpublicsetDefaultFormat(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.

Parameters
NameTypeDescription
$formatnull | string
Returns
TypeDescription
\Zend_View_Helper_TinySrc
Throws
ExceptionDescription
\Zend_View_Exception
methodpublicsetView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
\Zend_View_Helper_Abstract
methodpublictinySrc(mixed $image = null, array $options = array()) : void

Generate a link or image tag pointing to tinysrc.net

Parameters
NameTypeDescription
$imagemixed
$optionsarray
Documentation was generated by phpDocumentor 2.0.0a12.