API Documentation

Zend/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 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
\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'

Properties

Propertyprotectedstring  $_baseUrl= ''

Base URL for images
Details
Type
string
Propertyprotectedbool  $_createTagFlag= 'true'

Whether or not to create an image tag
Default valuetrueDetails
Type
bool
Propertyprotectedarray  $_defaultOptions= 'array( 'base_url' => null'

Default options

Used when determining what options were passed, and needing to merge them with default options.

Default valuearray( 'base_url' => nullDetails
Type
array
Propertyprotectedstring  $_dimensions= ''''

Default width and height
Default value''Details
Type
string
Propertyprotectedstring  $_format= ''''

Default image format to use
Default value''Details
Type
string

Methods

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_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
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
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
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 DocBlox 0.15.1.