Skip to content

Latest commit

 

History

History
747 lines (369 loc) · 16.1 KB

class.Image.md

File metadata and controls

747 lines (369 loc) · 16.1 KB

Class Image

this class provide functions to edit an image, e.g. resize, rotate, flip, crop

Contents

Properties

Methods

Properties

$_debug

public mixed $_debug = false

$_errors

public mixed $_errors = array()

$_imgFinal

public mixed $_imgFinal = null

$_imgInfoFinal

public mixed $_imgInfoFinal = array('name' => '', 'ext' => '', 'size' => '', 'width' => '', 'height' => '', 'type' => '', 'path' => '')

$_imgInfoOrig

public mixed $_imgInfoOrig = array('name' => '', 'ext' => '', 'size' => '', 'width' => '', 'height' => '', 'type' => '', 'path' => '')

$_imgOrig

public mixed $_imgOrig = null

$_imgQuality

public mixed $_imgQuality = 90

$chmod

public mixed $chmod = 493

$gdInfo

public mixed $gdInfo = array()

$imageFile

public mixed $imageFile = null

$transparentColorBlue

public mixed $transparentColorBlue = null

$transparentColorGreen

public mixed $transparentColorGreen = null

$transparentColorRed

public mixed $transparentColorRed = null

Methods

DestroyImages

void Image::DestroyImages(boolean $original)

Destroy the resources used by the images.

Arguments

  • $original boolean

Image

mixed Image::Image($debug)

Arguments

  • $debug mixed

__construct

\Image Image::__construct(boolean $debug)

constructor

Arguments

  • $debug boolean

_createFinalImageHandler

mixed Image::_createFinalImageHandler($dst_w, $dst_h)

create final image handler

@access private

Arguments

  • $dst_w mixed - width @param $dst_h height @return boolean @copyright original from noname at nivelzero dot ro
  • $dst_h mixed

_debug

void Image::_debug($value)

append to errors array and shown the each error when the debug turned on

Arguments

  • $value mixed

_getExtension

string Image::_getExtension(string $file)

Get the extension of a file name

Arguments

  • $file string

_getImageInfo

array Image::_getImageInfo($imagePath)

get image information, e.g. width, height, type

Arguments

  • $imagePath mixed

_isDebugEnable

boolean Image::_isDebugEnable()

check if debug enable

_isSupported

boolean Image::_isSupported(string $filename, string $extension, string $function, boolean $write)

Validate whether image reading/writing routines are valid.

Arguments

  • $filename string
  • $extension string
  • $function string
  • $write boolean

_resize

\unknown Image::_resize(integer $new_x, integer $new_y)

resize the image and return the thumbnail image details array("width"=>, "height"=>, "name")

Arguments

  • $new_x integer - the thumbnail width
  • $new_y integer - the thumbnail height

crop

boolean Image::crop(integer $dst_x, integer $dst_y, integer $dst_w, integer $dst_h)

Used for cropping image

Arguments

  • $dst_x integer
  • $dst_y integer
  • $dst_w integer
  • $dst_h integer

enableDebug

mixed Image::enableDebug(boolean $value)

enable to debug

Arguments

  • $value boolean

flip

boolean Image::flip(string $direction)

flip image horizotally or vertically

Arguments

  • $direction string

flipHorizontal

string Image::flipHorizontal()

flip horizontal

flipVertical

boolean Image::flipVertical()

flip vertically

getFinalImageInfo

array Image::getFinalImageInfo()

return the final image info

getGDInfo

array Image::getGDInfo(boolean $versionOnly)

get the GD version information

Arguments

  • $versionOnly boolean

getImageInfo

mixed Image::getImageInfo($imagePath)

Arguments

  • $imagePath mixed

getOriginalImageInfo

array Image::getOriginalImageInfo()

get the original image info

loadImage

boolean Image::loadImage(string $filename)

Load an image from the file system.

Arguments

  • $filename string

loadImageFromString

boolean Image::loadImageFromString(string $string)

Load an image from a string (eg. from a database table)

Arguments

  • $string string

resize

mixed Image::resize(mixed $new_x, mixed $new_y, boolean $constraint, boolean $unchangeIfsmaller)

Resize the Image in the X and/or Y direction If either is 0 it will be scaled proportionally

Arguments

  • $new_x mixed
  • $new_y mixed
  • $constraint boolean - keep to resize the image proportionally
  • $unchangeIfsmaller boolean - keep the orignial size if the orignial smaller than the new size

rotate

mixed Image::rotate($angle, $bgColor)

Arguments

  • $angle mixed
  • $bgColor mixed

saveImage

boolean Image::saveImage(string $filename, integer $quality, string $forcetype)

Save the modified image

Arguments

  • $filename string
  • $quality integer
  • $forcetype string

showErrors

mixed Image::showErrors()

show erros

showImage

boolean Image::showImage(string $type, integer $quality)

Shows the masked image without any saving

Arguments

  • $type string
  • $quality integer