PHP Class SlightPHP\Thumbnail

Show file Open project: hetao29/slightphp

Protected Properties

Property Type Description
$formats array possible image formats
$image resource
$image_height integer
$image_path string path/filename of imagefile
$image_type integer image format of source
$image_width integer
$quality_thumb boolean quality or speed when generating the thumbnail
$thumb_max_height integer maximal height of the generated thumbnail
$thumb_max_width integer maximal width of the generated thumbnail
$thumbnail resource
$thumbnail_height integer
$thumbnail_type integer image format of the thumbnail
$thumbnail_width integer

Public Methods

Method Description
__construct ( string $file = '' ) : void Constructor
getPictureName ( ) : integer returns the width of the thumbnail
getThumbHeight ( ) : integer returns the height of the thumbnail
getThumbWidth ( ) : integer returns the width of the thumbnail
outputThumbnail ( string $format = 'png', integer $quality = 75 ) : void outputs the thumbnail to the browser
returnThumbnail ( ) : mixed returns the variable with the thumbnail image
setMaxHeight ( integer $height ) : boolean sets the max. height of the thumbnail
setMaxSize ( integer $width, integer $height ) : boolean sets the max. width and height of the thumbnail
setMaxWidth ( integer $width ) : boolean sets the max. width of the thumbnail
setOutputFormat ( string $format = 'png' ) : void sets the output type of the thumbnail
setQualityOutput ( boolean $boolean = TRUE ) : void whether to create thumbs fast or with good quality

Protected Methods

Method Description
createThumbnail ( ) : void creates the thumbnail and saves it to a variable
readSourceImage ( ) : void reads the source image into a variable
readSourceImageData ( ) : void reads metadata of the source image
setThumbnailSize ( ) : void sets the actual width and height of the thumbnail based on the source image size and the max limits for the thumbnail

Method Details

__construct() public method

Constructor
public __construct ( string $file = '' ) : void
$file string path/filename of picture or stream from a DB field
return void

createThumbnail() protected method

creates the thumbnail and saves it to a variable
protected createThumbnail ( ) : void
return void

getPictureName() public method

returns the width of the thumbnail
public getPictureName ( ) : integer
return integer

getThumbHeight() public method

returns the height of the thumbnail
public getThumbHeight ( ) : integer
return integer

getThumbWidth() public method

returns the width of the thumbnail
public getThumbWidth ( ) : integer
return integer

outputThumbnail() public method

outputs the thumbnail to the browser
public outputThumbnail ( string $format = 'png', integer $quality = 75 ) : void
$format string
$quality integer
return void

readSourceImage() protected method

reads the source image into a variable
protected readSourceImage ( ) : void
return void

readSourceImageData() protected method

reads metadata of the source image
protected readSourceImageData ( ) : void
return void

returnThumbnail() public method

returns the variable with the thumbnail image
public returnThumbnail ( ) : mixed
return mixed

setMaxHeight() public method

sets the max. height of the thumbnail
public setMaxHeight ( integer $height ) : boolean
$height integer
return boolean

setMaxSize() public method

passes values to the functions setMaxHeight() and setMaxWidth()
public setMaxSize ( integer $width, integer $height ) : boolean
$width integer
$height integer
return boolean

setMaxWidth() public method

sets the max. width of the thumbnail
public setMaxWidth ( integer $width ) : boolean
$width integer
return boolean

setOutputFormat() public method

sets the output type of the thumbnail
public setOutputFormat ( string $format = 'png' ) : void
$format string gif, jpg, png, wbmp
return void

setQualityOutput() public method

whether to create thumbs fast or with good quality
public setQualityOutput ( boolean $boolean = TRUE ) : void
$boolean boolean
return void

setThumbnailSize() protected method

sets the actual width and height of the thumbnail based on the source image size and the max limits for the thumbnail
protected setThumbnailSize ( ) : void
return void

Property Details

$formats protected property

possible image formats
protected array $formats
return array

$image protected property

protected resource $image
return resource

$image_height protected property

protected int $image_height
return integer

$image_path protected property

path/filename of imagefile
protected string $image_path
return string

$image_type protected property

image format of source
protected int $image_type
return integer

$image_width protected property

protected int $image_width
return integer

$quality_thumb protected property

quality or speed when generating the thumbnail
protected bool $quality_thumb
return boolean

$thumb_max_height protected property

maximal height of the generated thumbnail
protected int $thumb_max_height
return integer

$thumb_max_width protected property

maximal width of the generated thumbnail
protected int $thumb_max_width
return integer

$thumbnail protected property

protected resource $thumbnail
return resource

$thumbnail_height protected property

protected int $thumbnail_height
return integer

$thumbnail_type protected property

image format of the thumbnail
protected int $thumbnail_type
return integer

$thumbnail_width protected property

protected int $thumbnail_width
return integer