Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | List of all members
eZImageInterface Class Reference

Base interface for all image object and layer classes. More...

Inheritance diagram for eZImageInterface:

## Public Member Functions
| __construct ( $imageObjectRef=null, $imageObject=null, $width=false, $height=false)
| isTruecolor ()
| attributes ()
| hasAttribute ( $name)
| attribute ( $name)
| isProcessed ()
& | hasSize ()
& | imagePath ()
| setAlternativeText ( $text)
| alternativeText ()
| loadPNG ( $storedPath, $storedFile)
| loadJPEG ( $storedPath, $storedFile)
| loadGIF ( $storedPath, $storedFile)
| load ()
| destroy ()
| imageObject ( $createMissing=true)
| process ()
| processImage ()
| store ( $fileName, $filePath, $type)
| create ( $width, $height, $useTruecolor=null)
| __clone ()
| cloneImage ( $imageObject, $width, $height, $useTruecolor=null)
| width ()
| height ()
| setWidth ( $w)
| setHeight ( $h)
| setStoredFile ( $file, $path, $type)
| setFont ( $font)
| font ()
| copyImage ( $destinationImageObject, $imageObject, $destinationX, $destinationY, $sourceWidth, $sourceHeight, $sourceX=0, $sourceY=0)
| mergeImage ( $destinationImageObject, $imageObject, $destinationX, $destinationY, $sourceWidth, $sourceHeight, $sourceX=0, $sourceY=0, $transparency=0)
| blendImage ( $destinationImageObject, $imageObject, $destinationX, $destinationY, $sourceWidth, $sourceHeight, $sourceX=0, $sourceY=0)
| merge ( $imageObject, $x, $y, $width, $height)
| clear ( $color=false)
| allocateColor ( $name, $red, $green, $blue)
| color ( $name)
| textColor ()
| setTextColor ( $textColor)
| drawText (&$font, $textColor, $text, $x, $y, $angle, $imageObject=null)

## Static Public Member Functions
static | unregisterImage ( $imageRef)
static | cleanupRegisteredImages ()
static | hasGD2 ()

## Public Attributes
| $TextColor
| $Width
| $Height
| $Font
| $ImageObject
| $ImageObjectRef
| $StoredFile
| $StoredPath
| $StoredType
| $PaletteIndex
| $Palette
| $AlternativeText
| $IsTrueColor
| $IsProcessed

## Protected Member Functions
| imageObjectInternal ( $createMissing=true)

## Static Protected Member Functions
static | registerImage ( $image)

## Private Member Functions
| attributeMemberMap ()
| attributeFunctionMap ()

## Static Private Member Functions
static | createImage ( $width, $height, &$useTruecolor)

## Detailed Description

Base interface for all image object and layer classes.

Definition at line 19 of file ezimageinterface.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZImageInterface::__construct | ( |  | $imageObjectRef = `null`,
|  |  | $imageObject = `null`,
|  |  | $width = `false`,
|  |  | $height = `false`
| ) |  |

Constructor

Parameters

  string | $imageObjectRef |
  eZContentObject | $imageObject |
  int | bool | $width |
  int | bool | $height |

Reimplemented in eZImageObject.

Definition at line 30 of file ezimageinterface.php.

## Member Function Documentation

## ◆ __clone()

eZImageInterface::__clone | ( |  | ) |

Copies the image from $image as the current image object.

Definition at line 529 of file ezimageinterface.php.

References cloneImage(), height(), imageObject(), isTruecolor(), and width().

## ◆ allocateColor()

eZImageInterface::allocateColor | ( |  | $name,
|  |  | $red,
|  |  | $green,
|  |  | $blue
| ) |  |

Allocates the color $red, $green and $blue with name $name and returns it. Will return the palette index for palette based images and the color value for true color.

Definition at line 694 of file ezimageinterface.php.

References eZDebug\writeError().

## ◆ alternativeText()

eZImageInterface::alternativeText | ( |  | ) |

Returns
  the alternative text for the image.

See also
  setAlternativeText

Definition at line 169 of file ezimageinterface.php.

References $AlternativeText.

## ◆ attribute()

eZImageInterface::attribute | ( |  | $name | ) |

Returns
  the attribute with name $name or `null` if the attribute does not exist.

Definition at line 105 of file ezimageinterface.php.

References attributeFunctionMap(), attributeMemberMap(), eZDebug\writeError(), and eZDebug\writeWarning().

## ◆ attributeFunctionMap()

eZImageInterface::attributeFunctionMap | ( |  | ) |
| private

Returns
  a map array which maps from an attribute name to a member function. Used by attributes, hasAttribute and attribute.

Definition at line 73 of file ezimageinterface.php.

Referenced by attribute(), attributes(), and hasAttribute().

## ◆ attributeMemberMap()

eZImageInterface::attributeMemberMap | ( |  | ) |
| private

Returns
  a map array which maps from an attribute name to a member variable. Used by attributes, hasAttribute and attribute.

Definition at line 59 of file ezimageinterface.php.

Referenced by attribute(), attributes(), and hasAttribute().

## ◆ attributes()

eZImageInterface::attributes | ( |  | ) |

Returns
  an array with attribute names which this object supports.

Definition at line 82 of file ezimageinterface.php.

References attributeFunctionMap(), and attributeMemberMap().

## ◆ blendImage()

eZImageInterface::blendImage | ( |  | $destinationImageObject,
|  |  | $imageObject,
|  |  | $destinationX,
|  |  | $destinationY,
|  |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $sourceX = `0`,
|  |  | $sourceY = `0`
| ) |  |

Alpha blends the image $imageObject with size $sourceWidth and $sourceHeight and position $sourceX and $sourceY onto the destination image $destinationImageObject at position $destinationX and $destinationY.

Note
  This required GD2 and uses color 0 (black) for blending.

Definition at line 651 of file ezimageinterface.php.

## ◆ cleanupRegisteredImages()

static eZImageInterface::cleanupRegisteredImages | ( |  | ) |
| static

Cleans up all registered images.

Definition at line 211 of file ezimageinterface.php.

Referenced by eZGlobalImageCleanupFunction().

## ◆ clear()

eZImageInterface::clear | ( |  | $color = `false` | ) |

Clears the image object with color $color. If $color is not specified it will use the first color set.

Definition at line 676 of file ezimageinterface.php.

References color().

Referenced by eZImageTextLayer\processImage().

## ◆ cloneImage()

eZImageInterface::cloneImage | ( |  | $imageObject,
|  |  | $width,
|  |  | $height,
|  |  | $useTruecolor = `null`
| ) |  |

Clones the image object $imageObject with width $width, height $height and truecolor settings $useTruecolor.

Definition at line 539 of file ezimageinterface.php.

References createImage(), destroy(), and registerImage().

Referenced by __clone().

## ◆ color()

eZImageInterface::color | ( |  | $name | ) |

Returns
  the color for the name $name.

Definition at line 713 of file ezimageinterface.php.

References eZDebug\writeError().

Referenced by clear(), and drawText().

## ◆ copyImage()

eZImageInterface::copyImage | ( |  | $destinationImageObject,
|  |  | $imageObject,
|  |  | $destinationX,
|  |  | $destinationY,
|  |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $sourceX = `0`,
|  |  | $sourceY = `0`
| ) |  |

Copies the image $imageObject with size $sourceWidth and $sourceHeight and position $sourceX and $sourceY onto the destination image $destinationImageObject at position $destinationX and $destinationY.

Definition at line 616 of file ezimageinterface.php.

## ◆ create()

eZImageInterface::create | ( |  | $width,
|  |  | $height,
|  |  | $useTruecolor = `null`
| ) |  |

Creates a new image object with width $width and height $height. $useTruecolor determines the type of image, if `true` it will be truecolor, if `false` it will be palette based or if `null` it will create it depending on the GD version. GD 2 will get truecolor while < 2 will get palette based.

Definition at line 510 of file ezimageinterface.php.

References createImage(), destroy(), and registerImage().

Referenced by imageObjectInternal().

## ◆ createImage()

static eZImageInterface::createImage | ( |  | $width,
|  |  | $height,
|  | & | $useTruecolor
| ) |  |
| static private

Creates an image with size $width and $height using GD and returns it.

Definition at line 484 of file ezimageinterface.php.

References hasGD2(), and eZDebug\writeWarning().

Referenced by cloneImage(), and create().

## ◆ destroy()

eZImageInterface::destroy | ( |  | ) |

Cleans up the current image object if it is set.

Reimplemented in eZImageObject.

Definition at line 320 of file ezimageinterface.php.

References unregisterImage().

Referenced by cloneImage(), and create().

## ◆ drawText()

eZImageInterface::drawText | ( | & | $font,
|  |  | $textColor,
|  |  | $text,
|  |  | $x,
|  |  | $y,
|  |  | $angle,
|  |  | $imageObject = `null`
| ) |  |

Draws the text $text using the font $font and color $textColor at position $x and $y with angle $angle. If $imageObject is specified it will use that for drawing instead of the current image.

Definition at line 745 of file ezimageinterface.php.

References $ImageObject, color(), and eZDebug\writeWarning().

Referenced by eZImageTextLayer\mergeLayer(), and eZImageTextLayer\processImage().

## ◆ font()

eZImageInterface::font | ( |  | ) |

Returns
  the current font object or `null` if not font object has been set.

Definition at line 606 of file ezimageinterface.php.

References $Font.

Referenced by eZImageTextLayer\mergeLayer(), and eZImageTextLayer\processImage().

## ◆ hasAttribute()

eZImageInterface::hasAttribute | ( |  | $name | ) |

Returns
  true if the attribute $name exists.

Definition at line 91 of file ezimageinterface.php.

References attributeFunctionMap(), and attributeMemberMap().

## ◆ hasGD2()

static eZImageInterface::hasGD2 | ( |  | ) |
| static

Returns
  true if GD2 is installed.

Definition at line 463 of file ezimageinterface.php.

Referenced by createImage().

## ◆ hasSize()

& eZImageInterface::hasSize | ( |  | ) |

Returns
  true if the width and height of the image has been set.

Definition at line 141 of file ezimageinterface.php.

## ◆ height()

eZImageInterface::height | ( |  | ) |

Returns
  the current height of the image or false if no size has been set.

Definition at line 563 of file ezimageinterface.php.

References $Height.

Referenced by __clone(), eZImageObject\calculatePosition(), eZImageObject\flatten(), eZImageLayer\mergeLayer(), and eZImageTextLayer\mergeLayer().

## ◆ imageObject()

eZImageInterface::imageObject | ( |  | $createMissing = `true` | ) |

Returns
  the current image object, if $createMissing is true if will run the image processing to make sure it is created. Returns `null` if no image is available.

See also
  imageObjectInternal

Definition at line 338 of file ezimageinterface.php.

References $ImageObject, and process().

Referenced by __clone(), eZImageLayer\mergeLayer(), and store().

## ◆ imageObjectInternal()

eZImageInterface::imageObjectInternal | ( |  | $createMissing = `true` | ) |
| protected

Returns
  the current image object, will create an empty image object if $createMissing is true and the image object is not already created.

See also
  imageObject

Definition at line 360 of file ezimageinterface.php.

References $ImageObject, and create().

Referenced by eZImageTextLayer\mergeLayer(), and eZImageTextLayer\processImage().

## ◆ imagePath()

& eZImageInterface::imagePath | ( |  | ) |

Returns
  the path to the image file including the file.

Definition at line 150 of file ezimageinterface.php.

References $StoredFile.

## ◆ isProcessed()

eZImageInterface::isProcessed | ( |  | ) |

Returns
  true if the image object has been processed, this means that image has been rendered.

Definition at line 133 of file ezimageinterface.php.

References $IsProcessed.

## ◆ isTruecolor()

eZImageInterface::isTruecolor | ( |  | ) |

Returns
  true if the image is true color. True color images behave differently from palette based and GD has problems with mixing the two types.

Definition at line 49 of file ezimageinterface.php.

References $IsTrueColor.

Referenced by __clone(), and eZImageLayer\mergeLayer().

## ◆ load()

eZImageInterface::load | ( |  | ) |

Tries to load the stored image set by setStoredFile(). If the stored type is not set it will try all formats until one succeeds.

Returns
  true if succesful.

Definition at line 281 of file ezimageinterface.php.

References loadGIF(), loadJPEG(), loadPNG(), and eZDebug\writeError().

Referenced by processImage().

## ◆ loadGIF()

eZImageInterface::loadGIF | ( |  | $storedPath,
|  |  | $storedFile
| ) |  |

Tries to load the GIF image from the path $storedPath and file $storedFile into the current image object.

Returns
  true if succesful.

Definition at line 263 of file ezimageinterface.php.

References registerImage().

Referenced by load().

## ◆ loadJPEG()

eZImageInterface::loadJPEG | ( |  | $storedPath,
|  |  | $storedFile
| ) |  |

Tries to load the JPEG image from the path $storedPath and file $storedFile into the current image object.

Returns
  true if succesful.

Definition at line 247 of file ezimageinterface.php.

References registerImage().

Referenced by load().

## ◆ loadPNG()

eZImageInterface::loadPNG | ( |  | $storedPath,
|  |  | $storedFile
| ) |  |

Tries to load the PNG image from the path $storedPath and file $storedFile into the current image object.

Returns
  true if succesful.

Definition at line 229 of file ezimageinterface.php.

References registerImage().

Referenced by load().

## ◆ merge()

eZImageInterface::merge | ( |  | $imageObject,
|  |  | $x,
|  |  | $y,
|  |  | $width,
|  |  | $height
| ) |  |

Definition at line 661 of file ezimageinterface.php.

## ◆ mergeImage()

eZImageInterface::mergeImage | ( |  | $destinationImageObject,
|  |  | $imageObject,
|  |  | $destinationX,
|  |  | $destinationY,
|  |  | $sourceWidth,
|  |  | $sourceHeight,
|  |  | $sourceX = `0`,
|  |  | $sourceY = `0`,
|  |  | $transparency = `0`
| ) |  |

Merges the image $imageObject with size $sourceWidth and $sourceHeight and position $sourceX and $sourceY with the destination image $destinationImageObject at position $destinationX and $destinationY. The merged image is placed on the $destinationImageObject.

Parameters

  $transparency | determines how transparent the source image is. 0 is the same as copyImage and 100 is the same is no copy is made.

Definition at line 633 of file ezimageinterface.php.

## ◆ process()

eZImageInterface::process | ( |  | ) |

Makes sure the image object is processed and rendered. Calls processImage() which is implemented by all descendants of this class to do the real work.

Definition at line 375 of file ezimageinterface.php.

References processImage().

Referenced by imageObject(), and store().

## ◆ processImage()

eZImageInterface::processImage | ( |  | ) |

\virtual Tries to render an image onto the image object, each inheriting class must override this to do somethign sensible. By default it will try to load the stored image if one is set.

Returns
  true if the image was succesfully processed.

Reimplemented in eZImageTextLayer, and eZImageObject.

Definition at line 387 of file ezimageinterface.php.

References load(), eZDir\path(), and eZDebug\writeWarning().

Referenced by process().

## ◆ registerImage()

static eZImageInterface::registerImage | ( |  | $image | ) |
| static protected

Registers the GD image object $image for destruction upon script end. This makes sure that image resources are cleaned up after use.

Returns
  a reference for the image which can be used in unregisterImage later on. Returns false if resource can't be registered.

Definition at line 180 of file ezimageinterface.php.

Referenced by cloneImage(), create(), loadGIF(), loadJPEG(), and loadPNG().

## ◆ setAlternativeText()

eZImageInterface::setAlternativeText | ( |  | $text | ) |

Sets the alternative text to $text, it will be used for describing the image and can be used by browsers that cannot view images.

Definition at line 160 of file ezimageinterface.php.

## ◆ setFont()

eZImageInterface::setFont | ( |  | $font | ) |

Sets the current font object to $font.

Definition at line 598 of file ezimageinterface.php.

Referenced by eZImageLayer\__construct().

## ◆ setHeight()

eZImageInterface::setHeight | ( |  | $h | ) |

Sets the height of the image to $h.

Definition at line 579 of file ezimageinterface.php.

Referenced by eZImageObject\flatten().

## ◆ setStoredFile()

eZImageInterface::setStoredFile | ( |  | $file,
|  |  | $path,
|  |  | $type
| ) |  |

Sets the path, file and type of the stored file. These settings will be used by load().

Definition at line 588 of file ezimageinterface.php.

## ◆ setTextColor()

eZImageInterface::setTextColor | ( |  | $textColor | ) |

Sets the color used for text drawing to $textColor.

Definition at line 734 of file ezimageinterface.php.

## ◆ setWidth()

eZImageInterface::setWidth | ( |  | $w | ) |

Sets the width of the image to $w.

Definition at line 571 of file ezimageinterface.php.

Referenced by eZImageObject\flatten().

## ◆ store()

eZImageInterface::store | ( |  | $fileName,
|  |  | $filePath,
|  |  | $type
| ) |  |

Stores the current image object to disk, the image is stored in the path $filePath with filename $fileName. The parameter $type determines the image format, supported are `png` and `jpg`.

Returns
  true if the image was stored correctly.

Definition at line 417 of file ezimageinterface.php.

References imageObject(), eZDir\mkdir(), eZDir\path(), process(), and eZDebug\writeError().

## ◆ textColor()

eZImageInterface::textColor | ( |  | ) |

Returns
  the color used for text drawing.

Definition at line 726 of file ezimageinterface.php.

References $TextColor.

Referenced by eZImageTextLayer\mergeLayer(), and eZImageTextLayer\processImage().

## ◆ unregisterImage()

static eZImageInterface::unregisterImage | ( |  | $imageRef | ) |
| static

Tries to unregister the image with reference $imageRef

Definition at line 198 of file ezimageinterface.php.

Referenced by destroy().

## ◆ width()

eZImageInterface::width | ( |  | ) |

Returns
  the current width of the image or false if no size has been set.

Definition at line 555 of file ezimageinterface.php.

References $Width.

Referenced by __clone(), eZImageObject\calculatePosition(), eZImageObject\flatten(), eZImageLayer\mergeLayer(), and eZImageTextLayer\mergeLayer().

## Member Data Documentation

## ◆ $AlternativeText

eZImageInterface::$AlternativeText

Definition at line 787 of file ezimageinterface.php.

Referenced by alternativeText().

## ◆ $Font

eZImageInterface::$Font

Definition at line 779 of file ezimageinterface.php.

Referenced by font().

## ◆ $Height

eZImageInterface::$Height

Definition at line 778 of file ezimageinterface.php.

Referenced by height().

## ◆ $ImageObject

eZImageInterface::$ImageObject

Definition at line 780 of file ezimageinterface.php.

Referenced by drawText(), imageObject(), and imageObjectInternal().

## ◆ $ImageObjectRef

eZImageInterface::$ImageObjectRef

Definition at line 781 of file ezimageinterface.php.

## ◆ $IsProcessed

eZImageInterface::$IsProcessed

Definition at line 789 of file ezimageinterface.php.

Referenced by isProcessed().

## ◆ $IsTrueColor

eZImageInterface::$IsTrueColor

Definition at line 788 of file ezimageinterface.php.

Referenced by isTruecolor().

## ◆ $Palette

eZImageInterface::$Palette

Definition at line 786 of file ezimageinterface.php.

## ◆ $PaletteIndex

eZImageInterface::$PaletteIndex

Definition at line 785 of file ezimageinterface.php.

## ◆ $StoredFile

eZImageInterface::$StoredFile

Definition at line 782 of file ezimageinterface.php.

Referenced by imagePath().

## ◆ $StoredPath

eZImageInterface::$StoredPath

Definition at line 783 of file ezimageinterface.php.

## ◆ $StoredType

eZImageInterface::$StoredType

Definition at line 784 of file ezimageinterface.php.

## ◆ $TextColor

eZImageInterface::$TextColor

Definition at line 21 of file ezimageinterface.php.

Referenced by textColor().

## ◆ $Width

eZImageInterface::$Width

Definition at line 777 of file ezimageinterface.php.

Referenced by width().

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

- ezimageinterface.php

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