View/Helper/TinySrc.php

Show: inherited
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 [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

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

Constant  TINYSRC_BASE = 'http://i.tinysrc.mobi'
Constant  EOL = "\n"
inherited

EOL character

Inherited from: \Zend_View_Helper_HtmlElement::EOL

Properties

Propertyprotectedstring $_baseUrl =

<p>Base URL for images</p>
Details
Type
string
Propertyprotectedstring $_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  
Propertyprotectedbool $_createTagFlag = true

<p>Whether or not to create an image tag</p>
Default valuetrueDetails
Type
bool
Propertyprotectedarray $_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
Propertyprotectedstring $_dimensions = ''

<p>Default width and height</p>
Default value''Details
Type
string
Propertyprotectedstring $_format = ''

<p>Default image format to use</p>
Default value''Details
Type
string
Propertypublic\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
Name Type Description
$attribs array

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

Returns
Type Description
string The XHTML for the attributes.
Details
Access
public  
methodprotected_isStrictDoctype() : boolean
inherited

Is doctype strict?

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

Is doctype XHTML?

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

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

Parameters
Name Type Description
$options array
Returns
Type Description
string
methodprotected_mergeDimensions(array $options) : string

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

Parameters
Name Type Description
$options array
Returns
Type Description
string
methodprotected_mergeFormat(array $options) : string

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

Parameters
Name Type Description
$options array
Returns
Type Description
string
methodprotected_normalizeId(string $value) : string
inherited

Normalize an ID

Inherited from: \Zend_View_Helper_HtmlElement::_normalizeId()
Parameters
Name Type Description
$value string
Returns
Type Description
string
methodprotected_validateDimension(string $dim) : bool

Validate a dimension

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

Parameters
Name Type Description
$dim string
Returns
Type Description
bool
methodpubliccreateTag() : bool

Should the helper create an image tag?

Returns
Type Description
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
Type Description
string
methodpublicgetClosingBracket() : string
inherited

Get the tag closing bracket

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

Set base URL for images

Parameters
Name Type Description
$url string
Returns
Type Description
\Zend_View_Helper_TinySrc
methodpublicsetCreateTag(bool $flag) : \Zend_View_Helper_TinySrc

Set state of "create tag" flag

Parameters
Name Type Description
$flag bool
Returns
Type Description
\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
Name Type Description
$width null | int | string
$height null | int | string
Returns
Type Description
\Zend_View_Helper_TinySrc
Throws
Exception Description
\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
Name Type Description
$format null | string
Returns
Type Description
\Zend_View_Helper_TinySrc
Throws
Exception Description
\Zend_View_Exception
methodpublicsetView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
\Zend_View_Helper_Abstract
methodpublictinySrc(mixed $image = null, array $options = array()) : void

Generate a link or image tag pointing to tinysrc.net

Parameters
Name Type Description
$image mixed
$options array
Documentation was generated by phpDocumentor 2.0.0a8.