Gd Class Reference

Detailed Description

PHP GD extension interface.

The graphics_gd class provides depage::graphics features using the PHP GD extension.

Definition at line 18 of file Gd.php.

Public Member Functions

 render ($input, $output=null)
 Main method for image handling. More...
 
- Public Member Functions inherited from Graphics
 __construct ($options=array())
 graphics class constructor More...
 
 addBackground ($background)
 Background "action". More...
 
 addCrop ($width, $height, $x=0, $y=0)
 Adds crop action. More...
 
 addResize ($width, $height)
 Adds resize action. More...
 
 addThumb ($width, $height)
 Adds thumb action. More...
 
 addThumbfill ($width, $height, $centerX=50, $centerY=50)
 Adds thumb-fill action. More...
 
 render ($input, $output=null)
 Main method for image handling. More...
 
 renderFinished ()
 Called after rendering has finished. More...
 
 optimizeImage ($filename)
 Opimizes final image through one of the optimization programs. More...
 
 setQuality ($quality)
 Sets quality parameter. More...
 

Protected Member Functions

 crop ($width, $height, $x=0, $y=0)
 Crop action. More...
 
 resize ($width, $height)
 Resize action. More...
 
 thumb ($width, $height)
 Thumb action. More...
 
 thumbfill ($width, $height, $centerX=50, $centerY=50)
 Thumb-Fill action. More...
 
 load ()
 Loads image from file. More...
 
 save ()
 Saves image to file. More...
 
 getImageSize ()
 Determine size of input image. More...
 
- Protected Member Functions inherited from Graphics
 escapeNumber ($number)
 Validates integers. More...
 
 dimensions ($width, $height)
 Scales image dimensions. More...
 
 processQueue ()
 Process action queue. More...
 
 lock ()
 lock More...
 
 unlock ()
 unlock More...
 
 obtainFormat ($fileName)
 Determines image format from file extension. More...
 
 getQuality ()
 Returns quality-index for current image format. More...
 
 bypassTest ($width, $height, $x=0, $y=0)
 Tests if action would change current image. More...
 
 bypass ()
 Runs bypass (copies file) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Graphics
static factory ($options=array())
 graphics object factory More...
 
static which ($binary)
 Executes "which" command. More...
 
- Protected Attributes inherited from Graphics
 $input
 Input filename. More...
 
 $output
 Output filename. More...
 
 $format
 Output format. More...
 
 $outputLockFp = null
 
 $otherRender = false
 otherRender is set to true if another render process has already locked file More...
 
 $queue = array()
 Action queue array. More...
 
 $size = array()
 Image size array(width, height) More...
 
 $background
 Image background string. More...
 
 $quality = ''
 Image quality string. More...
 
 $optimize
 Optimize output images. More...
 
 $optimizers
 List of optimizer binaries. More...
 
 $limits = []
 limits (mainly for imagemagick and graphicsmagick) More...
 
 $inputFormat
 Input image format. More...
 
 $outputFormat
 Output image format. More...
 
 $bypass = true
 Process bypass bool. More...
 

Member Function Documentation

◆ crop()

crop (   $width,
  $height,
  $x = 0,
  $y = 0 
)
protected

Crop action.

Applies crop action to $this->image.

Parameters
int$widthoutput width
int$heightoutput height
int$xcrop x-offset
int$ycrop y-offset
Returns
void

Definition at line 31 of file Gd.php.

◆ getImageSize()

getImageSize ( )
protected

Determine size of input image.

Returns
void

Definition at line 202 of file Gd.php.

◆ load()

load ( )
protected

Loads image from file.

Determines image format and loads it to $this->image.

Returns
void

Definition at line 150 of file Gd.php.

◆ render()

render (   $input,
  $output = null 
)

Main method for image handling.

Starts actions, saves image, calls bypass if necessary.

Parameters
string$inputinput filename
string$outputoutput filename
Returns
void

Reimplemented from Graphics.

Definition at line 216 of file Gd.php.

◆ resize()

resize (   $width,
  $height 
)
protected

Resize action.

Applies resize action to $this->image.

Parameters
int$widthoutput width
int$heightoutput height
Returns
void

Definition at line 60 of file Gd.php.

◆ save()

save ( )
protected

Saves image to file.

Adds background and saves $this->image to file.

Returns
void

Definition at line 175 of file Gd.php.

◆ thumb()

thumb (   $width,
  $height 
)
protected

Thumb action.

Applies thumb action to $this->image.

Parameters
int$widthoutput width
int$heightoutput height
Returns
void

Definition at line 81 of file Gd.php.

◆ thumbfill()

thumbfill (   $width,
  $height,
  $centerX = 50,
  $centerY = 50 
)
protected

Thumb-Fill action.

Applies thumb-fill action to $this->image.

Parameters
int$widthoutput width
int$heightoutput height
int$centerXcenter of image from left in percent
int$centerYcenter of image from top in percent
Returns
void

Definition at line 116 of file Gd.php.


The documentation for this class was generated from the following file: