Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZImageGDHandler Class Reference
Image conversion and scaling

The class eZImageGDHandler does. More...

Inheritance diagram for eZImageGDHandler:

## Public Member Functions
| __construct ( $handlerName, $isGloballyEnabled, $outputRewriteType=self::REPLACE_SUFFIX, $conversionRules=false)
| convert ( $manager, $sourceMimeData, &$destinationMimeData, $filters=false)
| setImageBorderWidth ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| setImageBorder ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| createImageBorder ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| setImageColorspaceGray ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| setImageLuminance ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| setImageLuminanceNamed ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| setImageLuminanceColorScale ( $imageObject, $filterData, $sourceMimeData, $destinationMimeData, $colorScale)
| setImageColorThresholdName ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| cropImage ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImage ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImageDownOnly ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImageWidth ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImageHeight ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImageWidthDownOnly ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImageHeightDownOnly ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImageExact ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| scaleImagePercent ( $imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
| calculateScaledAspectGeometry ( $sourceWidth, $sourceHeight, $destinationWidth, $destinationHeight, $allowUpScale)
| calculateScaledPercentAspectGeometry ( $sourceWidth, $sourceHeight, $destinationWidthPercent, $destinationHeightPercent, $allowUpScale)
| calculateFixedWidthAspectGeometry ( $sourceWidth, $sourceHeight, $destinationWidth, $allowUpScale)
| calculateFixedHeightAspectGeometry ( $sourceWidth, $sourceHeight, $destinationHeight, $allowUpScale)
Public Member Functions inherited from eZImageHandler
| __construct ( $handlerName, $isEnabled=true, $outputRewriteType=self::REPLACE_SUFFIX, $supportedInputMIMETypes=false, $supportedOutputMIMETypes=false, $conversionRules=false, $filters=false, $mimeTagMap=false)
| isAvailable ()
| tagForMIMEType ( $mimeData)
| supportedImageFilters ()
| conversionRules ()
| textForFilter ( $filterData)
| rewriteURL ( $originalMimeData, &$destinationMimeData, $rewriteType, $aliasName=false)
| supportedInputMIMETypes ()
| supportedOutputMIMETypes ()
| isOutputMIMETypeSupported ( $mimeData)
| isInputMIMETypeSupported ( $mimeData)
| outputMIMEType (&$manager, $currentMimeData, $wantedMimeData, $supportedFormatsOriginal, $aliasName=false)
| outputRewriteType ()
| isFilterSupported ( $filter)

## Static Public Member Functions
static | setImageBorderColor (&$imageObject, $filterData, &$filterVariables, $sourceMimeData, $destinationMimeData)
static | setImageColorThreshold ( $imageObject, $filterData, $sourceMimeData, $destinationMimeData, $thresholdList)
static | scaleImageCopy ( $imageObject, $geometry, $sourceMimeData, $destinationMimeData)
static | imageCopy ( $imageObject, $destinationGeometry, $sourceGeometry, $sourceMimeData, $destinationMimeData)
static | isImageTrueColor (&$imageObject, $mimeData)
static | imageCreate ( $width, $height, $isTrueColor=true)
static | createGeometry ( $width, $height, $x=0, $y=0)
static | createFromINI ( $iniGroup, $iniFilename=false)
Static Public Member Functions inherited from eZImageHandler
static | createFilterDefinitionFromINI ( $filterText)
static | convertFilterToText ( $filterDefinition, $filterData)
static | changeFilePermissions ( $filepath)
static | wildcardToRegexp ( $wildcard, $separatorCharacter=false)

## Public Attributes
| $Path
| $Executable
| $PreParameters
| $PostParameters
| $InputMap
| $OutputMap
| $OutputQualityMap
| $FilterFunctionMap
| $LuminanceColorScales
| $ThresholdList
| $HandlerName
| $SupportedInputMIMETypes
| $SupportedOutputMIMETypes
| $ConversionRules
| $OutputRewriteType
| $Filters
| $FilterMap
| $SupportImageFilters
| $MIMETagMap
| $IsEnabled
Public Attributes inherited from eZImageHandler
| $HandlerName
| $SupportedInputMIMETypes
| $SupportedOutputMIMETypes
| $ConversionRules
| $OutputRewriteType
| $Filters
| $FilterMap
| $SupportImageFilters
| $MIMETagMap
| $IsEnabled
const | KEEP_SUFFIX = 1
const | REPLACE_SUFFIX = 2
const | PREPEND_TAG_REPLACE_SUFFIX = 3

## Detailed Description

The class eZImageGDHandler does.

A geometry array has the following entries.

- x - The x position
- y - The y position
- width - The width
- height - The height

Definition at line 23 of file ezimagegdhandler.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZImageGDHandler::__construct | ( |  | $handlerName,
|  |  | $isGloballyEnabled,
|  |  | $outputRewriteType = `self::REPLACE_SUFFIX`,
|  |  | $conversionRules = `false`
| ) |  |

Definition at line 25 of file ezimagegdhandler.php.

## Member Function Documentation

## ◆ calculateFixedHeightAspectGeometry()

eZImageGDHandler::calculateFixedHeightAspectGeometry | ( |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $destinationHeight,
|  |  | $allowUpScale
| ) |  |

Calculates the geometry for the scaled image with a fixed height while maintaining the aspect ratio.

Parameters

  $allowUpScale | If this is true images will be scaled up as well, if not they will keep their source size.

Returns
  a geometry array.

See also
  createGeometry

Definition at line 615 of file ezimagegdhandler.php.

References createGeometry().

Referenced by scaleImageHeight(), and scaleImageHeightDownOnly().

## ◆ calculateFixedWidthAspectGeometry()

eZImageGDHandler::calculateFixedWidthAspectGeometry | ( |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $destinationWidth,
|  |  | $allowUpScale
| ) |  |

Calculates the geometry for the scaled image with a fixed width while maintaining the aspect ratio.

Parameters

  $allowUpScale | If this is true images will be scaled up as well, if not they will keep their source size.

Returns
  a geometry array.

See also
  createGeometry

Definition at line 590 of file ezimagegdhandler.php.

References createGeometry().

Referenced by scaleImageWidth(), and scaleImageWidthDownOnly().

## ◆ calculateScaledAspectGeometry()

eZImageGDHandler::calculateScaledAspectGeometry | ( |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $destinationWidth,
|  |  | $destinationHeight,
|  |  | $allowUpScale
| ) |  |

Calculates the geometry for the scaled image while maintaining the aspect ratio.

Parameters

  $allowUpScale | If this is true images will be scaled up as well, if not they will keep their source size.

Returns
  a geometry array.

See also
  createGeometry

Definition at line 542 of file ezimagegdhandler.php.

References createGeometry().

Referenced by calculateScaledPercentAspectGeometry(), scaleImage(), and scaleImageDownOnly().

## ◆ calculateScaledPercentAspectGeometry()

eZImageGDHandler::calculateScaledPercentAspectGeometry | ( |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $destinationWidthPercent,
|  |  | $destinationHeightPercent,
|  |  | $allowUpScale
| ) |  |

Calculates the geometry for the scaled image in terms of percent while maintaining the aspect ratio.

Parameters

  $allowUpScale | If this is true images will be scaled up as well, if not they will keep their source size.

Note
  Percentage must be given as a float value, e.g. 50% is 0.5 and 200% is 2.0

Returns
  a geometry array.

See also
  createGeometry

Definition at line 573 of file ezimagegdhandler.php.

References calculateScaledAspectGeometry().

Referenced by scaleImagePercent().

## ◆ convert()

eZImageGDHandler::convert | ( |  | $manager,
|  |  | $sourceMimeData,
|  | & | $destinationMimeData,
|  |  | $filters = `false`
| ) |  |
| virtual

Creates the shell string and runs the executable.

Implements eZImageHandler.

Definition at line 120 of file ezimagegdhandler.php.

References eZImageHandler\changeFilePermissions(), eZDebug\writeError(), and eZDebug\writeWarning().

## ◆ createFromINI()

static eZImageGDHandler::createFromINI | ( |  | $iniGroup,
|  |  | $iniFilename = `false`
| ) |  |
| static

Creates a new image handler for shell executable from INI settings. The INI settings are read from ini file $iniFilename and group $iniGroup. If $iniFilename is not supplied `image.ini` is used.

Definition at line 708 of file ezimagegdhandler.php.

References eZImageHandler\REPLACE_SUFFIX, and eZDebug\writeError().

Referenced by eZImageGDFactory\produceFromINI().

## ◆ createGeometry()

static eZImageGDHandler::createGeometry | ( |  | $width,
|  |  | $height,
|  |  | $x = `0`,
|  |  | $y = `0`
| ) |  |
| static

Creates a geometry array with width $width, height $height, x position $x and y position $y and returns it.

Definition at line 695 of file ezimagegdhandler.php.

Referenced by calculateFixedHeightAspectGeometry(), calculateFixedWidthAspectGeometry(), calculateScaledAspectGeometry(), createImageBorder(), cropImage(), and scaleImageExact().

## ◆ createImageBorder()

eZImageGDHandler::createImageBorder | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Definition at line 237 of file ezimagegdhandler.php.

References createGeometry(), and imageCopy().

Referenced by setImageBorder(), and setImageBorderWidth().

## ◆ cropImage()

eZImageGDHandler::cropImage | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Crops a portion of the image from the filter parameters.

Definition at line 409 of file ezimagegdhandler.php.

References createGeometry(), and imageCopy().

## ◆ imageCopy()

static eZImageGDHandler::imageCopy | ( |  | $imageObject,
|  |  | $destinationGeometry,
|  |  | $sourceGeometry,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |
| static

Copies a portion of the source image $imageObject to a new image.

Definition at line 658 of file ezimagegdhandler.php.

References imageCreate(), and isImageTrueColor().

Referenced by createImageBorder(), and cropImage().

## ◆ imageCreate()

static eZImageGDHandler::imageCreate | ( |  | $width,
|  |  | $height,
|  |  | $isTrueColor = `true`
| ) |  |
| static

Creates a new GD image and returns it.

Parameters

  $isTrueColor | determines if a true color image is created, if false an indexed image is created.

Definition at line 684 of file ezimagegdhandler.php.

Referenced by imageCopy(), and scaleImageCopy().

## ◆ isImageTrueColor()

static eZImageGDHandler::isImageTrueColor | ( | & | $imageObject,
|  |  | $mimeData
| ) |  |
| static

Returns
  `true` if the image object $imageObject is in true color format.

Definition at line 675 of file ezimagegdhandler.php.

Referenced by imageCopy(), and scaleImageCopy().

## ◆ scaleImage()

eZImageGDHandler::scaleImage | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ration maintained. This means that image will not be exactly the image size.

See also
  scaleImageExact

Definition at line 432 of file ezimagegdhandler.php.

References calculateScaledAspectGeometry(), and scaleImageCopy().

## ◆ scaleImageCopy()

static eZImageGDHandler::scaleImageCopy | ( |  | $imageObject,
|  |  | $geometry,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |
| static

Scales the image $imageObject to the size specified in $filterData.

Definition at line 637 of file ezimagegdhandler.php.

References imageCreate(), and isImageTrueColor().

Referenced by scaleImage(), scaleImageDownOnly(), scaleImageExact(), scaleImageHeight(), scaleImageHeightDownOnly(), scaleImagePercent(), scaleImageWidth(), and scaleImageWidthDownOnly().

## ◆ scaleImageDownOnly()

eZImageGDHandler::scaleImageDownOnly | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ration maintained. This means that image will not be exactly the image size.

Note
  The image will not be scaled if the source size is smaller than the destination size.

See also
  scaleImageExact

Definition at line 447 of file ezimagegdhandler.php.

References calculateScaledAspectGeometry(), and scaleImageCopy().

## ◆ scaleImageExact()

eZImageGDHandler::scaleImageExact | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData without caring about aspect ratio.

Definition at line 517 of file ezimagegdhandler.php.

References createGeometry(), and scaleImageCopy().

## ◆ scaleImageHeight()

eZImageGDHandler::scaleImageHeight | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ration maintained. This means that image will not be exactly the image size.

See also
  scaleImageExact

Definition at line 475 of file ezimagegdhandler.php.

References calculateFixedHeightAspectGeometry(), and scaleImageCopy().

## ◆ scaleImageHeightDownOnly()

eZImageGDHandler::scaleImageHeightDownOnly | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ration maintained. This means that image will not be exactly the image size.

Note
  The image will not be scaled if the source size is smaller than the destination size.

See also
  scaleImageExact

Definition at line 505 of file ezimagegdhandler.php.

References calculateFixedHeightAspectGeometry(), and scaleImageCopy().

## ◆ scaleImagePercent()

eZImageGDHandler::scaleImagePercent | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ratio maintained.

Definition at line 527 of file ezimagegdhandler.php.

References calculateScaledPercentAspectGeometry(), and scaleImageCopy().

## ◆ scaleImageWidth()

eZImageGDHandler::scaleImageWidth | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ration maintained. This means that image will not be exactly the image size.

See also
  scaleImageExact

Definition at line 461 of file ezimagegdhandler.php.

References calculateFixedWidthAspectGeometry(), and scaleImageCopy().

## ◆ scaleImageWidthDownOnly()

eZImageGDHandler::scaleImageWidthDownOnly | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Scales the image $imageObject to the size specified in $filterData with aspect ration maintained. This means that image will not be exactly the image size.

Note
  The image will not be scaled if the source size is smaller than the destination size.

See also
  scaleImageExact

Definition at line 490 of file ezimagegdhandler.php.

References calculateFixedWidthAspectGeometry(), and scaleImageCopy().

## ◆ setImageBorder()

eZImageGDHandler::setImageBorder | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Definition at line 231 of file ezimagegdhandler.php.

References createImageBorder().

## ◆ setImageBorderColor()

static eZImageGDHandler::setImageBorderColor | ( | & | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |
| static

Definition at line 219 of file ezimagegdhandler.php.

## ◆ setImageBorderWidth()

eZImageGDHandler::setImageBorderWidth | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Definition at line 225 of file ezimagegdhandler.php.

References createImageBorder().

## ◆ setImageColorspaceGray()

eZImageGDHandler::setImageColorspaceGray | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Converts the image to grayscale.

Definition at line 262 of file ezimagegdhandler.php.

References setImageLuminanceColorScale().

## ◆ setImageColorThreshold()

static eZImageGDHandler::setImageColorThreshold | ( |  | $imageObject,
|  |  | $filterData,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData,
|  |  | $thresholdList
| ) |  |
| static

Changes the colors of the image based on threshold values. The luminance will be calculated and if it is in a threshold range it will use the specified color for the range.

Definition at line 365 of file ezimagegdhandler.php.

Referenced by setImageColorThresholdName().

## ◆ setImageColorThresholdName()

eZImageGDHandler::setImageColorThresholdName | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Changes the colors of the image based on threshold values. The threshold values are based on the filter name.

Definition at line 343 of file ezimagegdhandler.php.

References setImageColorThreshold(), and eZDebug\writeDebug().

## ◆ setImageLuminance()

eZImageGDHandler::setImageLuminance | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Changes the colors of the image based on the luminance. The new scale for the colors are taken from the filter parameters, the parameters must contain three values.

Definition at line 273 of file ezimagegdhandler.php.

References setImageLuminanceColorScale().

## ◆ setImageLuminanceColorScale()

eZImageGDHandler::setImageLuminanceColorScale | ( |  | $imageObject,
|  |  | $filterData,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData,
|  |  | $colorScale
| ) |  |

Changes the colors of the image based on the luminance.

Parameters

  $colorScale | is an array with three float elements in range 0 to 1 that define the new color scale.

Definition at line 303 of file ezimagegdhandler.php.

Referenced by setImageColorspaceGray(), setImageLuminance(), and setImageLuminanceNamed().

## ◆ setImageLuminanceNamed()

eZImageGDHandler::setImageLuminanceNamed | ( |  | $imageObject,
|  |  | $filterData,
|  | & | $filterVariables,
|  |  | $sourceMimeData,
|  |  | $destinationMimeData
| ) |  |

Changes the colors of the image based on the luminance. The new scale for the colors are based on the name of the filters.

Definition at line 284 of file ezimagegdhandler.php.

References setImageLuminanceColorScale(), and eZDebug\writeDebug().

## Member Data Documentation

## ◆ $ConversionRules

eZImageGDHandler::$ConversionRules

Definition at line 766 of file ezimagegdhandler.php.

## ◆ $Executable

eZImageGDHandler::$Executable

Definition at line 753 of file ezimagegdhandler.php.

## ◆ $FilterFunctionMap

eZImageGDHandler::$FilterFunctionMap

Definition at line 760 of file ezimagegdhandler.php.

## ◆ $FilterMap

eZImageGDHandler::$FilterMap

Definition at line 769 of file ezimagegdhandler.php.

## ◆ $Filters

eZImageGDHandler::$Filters

Definition at line 768 of file ezimagegdhandler.php.

## ◆ $HandlerName

eZImageGDHandler::$HandlerName

Definition at line 763 of file ezimagegdhandler.php.

## ◆ $InputMap

eZImageGDHandler::$InputMap

Definition at line 757 of file ezimagegdhandler.php.

## ◆ $IsEnabled

eZImageGDHandler::$IsEnabled

Definition at line 772 of file ezimagegdhandler.php.

## ◆ $LuminanceColorScales

eZImageGDHandler::$LuminanceColorScales

Definition at line 761 of file ezimagegdhandler.php.

## ◆ $MIMETagMap

eZImageGDHandler::$MIMETagMap

Definition at line 771 of file ezimagegdhandler.php.

## ◆ $OutputMap

eZImageGDHandler::$OutputMap

Definition at line 758 of file ezimagegdhandler.php.

## ◆ $OutputQualityMap

eZImageGDHandler::$OutputQualityMap

Definition at line 759 of file ezimagegdhandler.php.

## ◆ $OutputRewriteType

eZImageGDHandler::$OutputRewriteType

Definition at line 767 of file ezimagegdhandler.php.

## ◆ $Path

eZImageGDHandler::$Path

Definition at line 752 of file ezimagegdhandler.php.

## ◆ $PostParameters

eZImageGDHandler::$PostParameters

Definition at line 755 of file ezimagegdhandler.php.

## ◆ $PreParameters

eZImageGDHandler::$PreParameters

Definition at line 754 of file ezimagegdhandler.php.

## ◆ $SupportedInputMIMETypes

eZImageGDHandler::$SupportedInputMIMETypes

Definition at line 764 of file ezimagegdhandler.php.

## ◆ $SupportedOutputMIMETypes

eZImageGDHandler::$SupportedOutputMIMETypes

Definition at line 765 of file ezimagegdhandler.php.

## ◆ $SupportImageFilters

eZImageGDHandler::$SupportImageFilters

Definition at line 770 of file ezimagegdhandler.php.

## ◆ $ThresholdList

eZImageGDHandler::$ThresholdList

Definition at line 762 of file ezimagegdhandler.php.

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

- ezimagegdhandler.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.