API > eden > image.php
View Source

class Eden_Image

Abstract definition for common image manipulations per image. PHP is not limited to creating just HTML output. It can also be used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more convenient, PHP can output image streams directly to a browser. You will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with.

Public Methods

public function blur()

Applies the selective blur filter. Blurs the image

Returns Eden_Image_Model

public function brightness($level)

Applies the brightness filter. Changes the brightness of the image.

Arguments

  1. *number level

Returns Eden_Image_Model

public function colorize($red, $blue, $green, $alpha = 0)

Applies the colorize filter. Like greyscale except you can specify the color.

Arguments

  1. *number red
  2. *number blue
  3. *number green
  4. number alpha

Returns Eden_Image_Model

public function contrast($level)

Applies the contrast filter. Changes the contrast of the image.

Arguments

  1. *number level

Returns Eden_Image_Model

public function crop($width = NULL, $height = NULL)

Crops the image

Arguments

  1. int|null the width; if null will use the original width
  2. int|null the height; if null will use the original height

Returns Eden_Image_Model

public function edgedetect()

Applies the edgedetect filter. Uses edge detection to highlight the edges in the image.

Returns Eden_Image_Model

public function emboss()

Applies the emboss filter. Embosses the image.

Returns Eden_Image_Model

public function gaussianBlur()

Applies the gaussian blur filter. Blurs the image using the Gaussian method.

Returns Eden_Image_Model

public function getDimensions()

Returns the size of the image

Returns array

public function getResource()

Returns the resource for custom editing

Returns [RESOURCE]

public function greyscale()

Applies the greyscale filter. Converts the image into grayscale.

Returns Eden_Image_Model

public function invert($vertical = false)

Inverts the image.

Arguments

  1. bool if true invert vertical; if false invert horizontal

Returns Eden_Image_Model

public function meanRemoval()

Applies the mean removal filter. Uses mean removal to achieve a "sketchy" effect.

Returns Eden_Image_Model

public function negative()

Applies the greyscale filter. Reverses all colors of the image.

Returns Eden_Image_Model

public function resize($width = NULL, $height = NULL)

Resizes the image. This is a version of scale but keeping it's original aspect ratio

Arguments

  1. int|null the width; if null will use the original width
  2. int|null the height; if null will use the original height

Returns Eden_Image_Model

public function rotate($degree, $background = 0)

Rotates the image.

Arguments

  1. *int the degree to rotate by
  2. int background color code

Returns Eden_Image_Model

public function scale($width = NULL, $height = NULL)

Scales the image. If width or height is set to NULL a width or height will be auto determined based on the aspect ratio

Arguments

  1. int|null the width; if null will use the original width
  2. int|null the height; if null will use the original height

Returns Eden_Image_Model

public function smooth($level)

Applies the smooth filter. Makes the image smoother.

Arguments

  1. *number level

Returns Eden_Image_Model

public function save($path, $type = NULL)

Saves the image data to a file

Arguments

  1. *string the path to save to
  2. string|null the render type

Returns this

class Eden_Image_Error

Image exception

Constants

  • GD_NOT_INSTALLED: PHP GD Library is not installed.
  • NOT_VALID_IMAGE_FILE: %s is not a valid image file.
  • NOT_STRING_MODEL: Argument %d is expecting a string or Eden_Image_Model.

© 2012 Openovate Labs. All rights reserved.