Class Image
A widget that can generate an image which is scaled to the screen resolution of the user, and can be made secured to prevent hot-linking from remote sites. Note that by default, a jpg file will be returned (the source file can be jpg, png, or gif).
Copyright: Copyright (c) 2012, John Collins (founder of Alpha Framework). All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Alpha Framework nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: The BSD License
Author: John Collins <dev@alphaframework.org>
Version: $Id: Image.inc 1568 2012-08-05 19:59:16Z alphadevx $
Since: 1.0
Located at view/widgets/Image.inc
public
|
#
__construct( mixed $source, mixed $width, mixed $height, mixed $sourceType, mixed $quality = 0.75, mixed $scale = false, mixed $secure = false )
The constructor. |
public
string
|
#
renderHTMLLink( mixed $altText = '' )
Renders the HTML <img> tag to the ViewImage controller, with all of the correct params to render the source image in the desired resolution. |
private
|
#
setFilename( )
Setter for the filename, which also creates a sub-directory under /cache for images when required |
public
|
|
public
|
|
private
|
|
private
boolean
|
|
private
|
|
public static
string
|
#
convertImageURLToPath( string $imgURL )
Converts a URL for an image to a relative file system path for the image, assuming it is hosted on the same server as the application. |
private
string
|
$title |
|
#
The title of the image for alt text (optional). |
private
string
|
$source |
|
#
The absolute path to the source image. |
private
|
$width |
|
#
The width of the image (can differ from the source file when scale=true). |
private
|
$height |
|
#
The height of the image (can differ from the source file when scale=true). |
private
|
$sourceType |
|
#
The file type of the source image (gif, jpg, or png supported) |
private
|
$quality |
|
#
The quality of the jpg image generated (0.00 to 1.00, 0.75 by default). |
private
|
$scale |
|
#
Flag to determine if the image will scale to match the target resolution (false by default). |
private
|
$secure |
|
#
Flag to determine if the link to the image will change every 24hrs, making hot-linking to the image difficult (false by default). |
private
string
|
$filename |
|
#
The auto-generated name of the cache file for the image. |
private static
|
$logger | null |
#
Trace logger |