depage-graphics
Loading...
Searching...
No Matches
Gd Class Reference

Detailed Description

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

Definition at line 19 of file Gd.php.

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $image
 Image resource identifier.
Protected Attributes inherited from Graphics
 $input
 Input filename.
 $output
 Output filename.
 $format
 Output format.
 $outputLockFp = null
 $otherRender = false
 otherRender is set to true if another render process has already locked file
 $queue = []
 Action queue array.
 $size = []
 Image size array(width, height)
 $background
 Image background string.
 $quality = ''
 Image quality string.
 $optimize
 Optimize output images.
 $optimizers
 List of optimizer binaries.
 $limits = []
 limits (mainly for imagemagick and graphicsmagick)
 $inputFormat
 Input image format.
 $outputFormat
 Output image format.
 $bypass = true
 Process bypass bool.

Additional Inherited Members

Static Public Member Functions inherited from Graphics
static factory ($options=[])
 graphics object factory
static which ($binary)
 Executes "which" command.

Member Function Documentation

◆ autoOrient()

autoOrient ( )
protected
Returns
void

Definition at line 211 of file Gd.php.

◆ crop()

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

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 37 of file Gd.php.

◆ getImageSize()

getImageSize ( )
protected
Returns
array image dimensions as array(width, height)

Reimplemented from Graphics.

Definition at line 249 of file Gd.php.

◆ load()

load ( )
protected

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

Returns
void

Definition at line 156 of file Gd.php.

◆ render()

render ( $input,
$output = null )

Starts actions, saves image, calls bypass if necessary.

Parameters
string$inputinput filename
string$outputoutput filename
Returns
void

Reimplemented from Graphics.

Definition at line 263 of file Gd.php.

◆ resize()

resize ( $width,
$height )
protected

Applies resize action to $this->image.

Parameters
int$widthoutput width
int$heightoutput height
Returns
void

Definition at line 66 of file Gd.php.

◆ save()

save ( )
protected

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

Returns
void

Definition at line 181 of file Gd.php.

◆ thumb()

thumb ( $width,
$height )
protected

Applies thumb action to $this->image.

Parameters
int$widthoutput width
int$heightoutput height
Returns
void

Definition at line 87 of file Gd.php.

◆ thumbfill()

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

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 122 of file Gd.php.

Field Documentation

◆ $image

$image
protected

Definition at line 24 of file Gd.php.


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