Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZImage Class Reference

## Public Member Functions
| __construct ( $id="")
| store ()
| delete ()
| get ( $id="")
| existsInCategory ( $category)
| setCategoryDefinition ( $value)
| categoryDefinition ()
& | getAll ()
| checkReadPermission (&$currentUser)
| checkWritePermission (&$currentUser)
| id ()
& | name ( $html=true)
| caption ( $html=true)
| description ( $html=true)
| fileName ()
| originalFileName ()
| fileExists ( $relative=false)
| filePath ( $relative=false)
& | watermarkPath ( $relative=false)
& | createWatermark ()
| imagePath ( $relative=false)
| requestImageVariation ( $width, $height, $convertToGray=false, $allow_error=false)
| writePermission ()
| readPermission ()
| user ()
| setName ( $value)
| setCaption ( $value)
| setDescription ( $value)
| setOriginalFileName ( $value)
| checkImage (&$file)
| setImage (&$file)
| setWritePermission ( $value)
| setReadPermission ( $value)
| setUser ( $user)
| width ()
| height ()
| variations ()
| categories ()
| setPhotographer ( $author)
| photographer ( $as_object=true)
| setKeywords ( $keywords)
| keywords ()
| articles ()
| products ()
| hasMap ()
| forum ( $as_object=true)
| imageIDFromForum ( $ForumID)

## Static Public Member Functions
static | search (&$queryText, $offset=0, $limit=30, $userID=-1)
static | searchCount ( $name, $literal=false)
static | getByOriginalFileName ( $id="")
static | getUnassigned ( $offset=-1, $limit=-1)
static | countUnassigned ()
static | isOwner ( $user, $image)
static | randomImage ( $categoryID=0)

## Public Attributes
| $ID
| $Name
| $Caption
| $Description
| $FileName
| $OriginalFileName
| $ReadPermission
| $WritePermission
| $UserID
| $PhotographerID
| $NewImage
| $Keywords

## Detailed Description

! eZImageCatalogue The eZImage class hadles images in the image catalogue.

Example code:

// Fetch an uploaded file and store it in the imagecatalogue.
$file = new eZPBImageFile();
// userfile is the name of the input in the html form
if ( $file->getUploadedFile( "userfile" ) )
{
$image = new eZImage();
$image->setName( $Name );
$image->setCaption( $Caption );
$image->setImage( $file );
$image->store();
}
else
{
print( $file->name() . " not uploaded successfully" );
}
// Get an image from the database and request a variation from it
// gets an image from the eZProduct class
// can also use code like $mainImage = new eZImage( 2 );
// where 2 is the id of the image in the catalogue.
$mainImage = $product->mainImage();
if ( $mainImage )
{
$variation = $mainImage->requestImageVariation( 250, 250 );
// set some template variables
$t->set_var( "main_image_uri", "/" . $variation->imagePath() );
$t->set_var( "main_image_width", $variation->width() );
$t->set_var( "main_image_height", $variation->height() );
$t->set_var( "main_image_caption", $mainImage->caption() );
}
else
{
$t->set_var( "main_image", "" );
}
eZImage
Definition: ezimage.php:95
eZImage\$Name
$Name
Definition: ezimage.php:1523
eZImage\$Caption
$Caption
Definition: ezimage.php:1524
eZPBImageFile
Definition: ezpbimagefile.php:71
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$variation
$variation
Definition: ezimagecatalogue/user/menubox.php:55
$product
$product
Definition: homepage.php:202
$mainImage
foreach( $pathArray as $path) $mainImage
Definition: productpreview.php:167
$image
$image
Definition: user/articlelist.php:242

See also
  eZImageVariation eZImageVariationGroup eZPBImageFile

TODO $t in the example just pops out of nowhere, giving us no indication of where it was created or what connection it has with this class

Definition at line 94 of file ezimage.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZImage::__construct | ( |  | $id = `""` | ) |

Constructs a new eZImage object.

Definition at line 99 of file ezimage.php.

References $id, and $ID.

## Member Function Documentation

## ◆ articles()

eZImage::articles | ( |  | ) |

Returns the articles that this image is used in.

Definition at line 1329 of file ezimage.php.

References $articles, $db, $i, $res, and eZDB\globalDatabase().

## ◆ caption()

eZImage::caption | ( |  | $html = `true` | ) |

Returns the caption of the image.

Definition at line 737 of file ezimage.php.

References $Caption, and eZTextTool\fixhtmlentities().

## ◆ categories()

eZImage::categories | ( |  | ) |

Returns the image's categories.

Definition at line 1246 of file ezimage.php.

References $category, $db, $i, $res, and eZDB\globalDatabase().

## ◆ categoryDefinition()

eZImage::categoryDefinition | ( |  | ) |

Returns the image's definition category.

Definition at line 471 of file ezimage.php.

References $category, $db, $res, and eZDB\globalDatabase().

## ◆ checkImage()

eZImage::checkImage | ( | & | $file | ) |

Returns true if the file is a valid image.

Definition at line 1046 of file ezimage.php.

References $file, $name, and file_exists().

## ◆ checkReadPermission()

eZImage::checkReadPermission | ( | & | $currentUser | ) |

Check what read permission the user have to this eZVirtualFile object.

Returns: User - if the user owns the file Group - if the user is member of the group All - if the file can be read by everybody False - if the user don't have access

Definition at line 566 of file ezimage.php.

References $currentUser, $ret, $user, and readPermission().

## ◆ checkWritePermission()

eZImage::checkWritePermission | ( | & | $currentUser | ) |

Check what write permission the user have to this eZVirtualFile object.

Returns: User - if the user owns the file Group - if the user is member of the group All - if the file can be write by everybody False - if the user don't have access

Definition at line 638 of file ezimage.php.

References $currentUser, $ret, $user, and writePermission().

## ◆ countUnassigned()

static eZImage::countUnassigned | ( |  | ) |
| static

Get the total count of all the unassigned images.

Definition at line 543 of file ezimage.php.

References $db, $image, and eZDB\globalDatabase().

## ◆ createWatermark()

& eZImage::createWatermark | ( |  | ) |

Definition at line 846 of file ezimage.php.

References $FileName, $ini, $ret, eZPBFile\chmod(), filePath(), and eZPBLog\writeNotice().

Referenced by watermarkPath().

## ◆ delete()

eZImage::delete | ( |  | ) |

Delete the eZImageVariation object from the database and the filesystem.

Definition at line 323 of file ezimage.php.

References $db, $variation, file_exists(), filePath(), eZDB\globalDatabase(), eZPBFile\unlink(), and variations().

## ◆ description()

eZImage::description | ( |  | $html = `true` | ) |

Returns the description of the image.

Definition at line 751 of file ezimage.php.

References $Description, and eZTextTool\fixhtmlentities().

## ◆ existsInCategory()

eZImage::existsInCategory | ( |  | $category | ) |

Returns true if the image is assigned to the category given as argument. False if not.

Definition at line 414 of file ezimage.php.

References $category, $db, $ret, and eZDB\globalDatabase().

## ◆ fileExists()

eZImage::fileExists | ( |  | $relative = `false` | ) |

Definition at line 776 of file ezimage.php.

References $FileName, and file_exists().

## ◆ fileName()

eZImage::fileName | ( |  | ) |

Returns the filename of the image.

Definition at line 763 of file ezimage.php.

References $FileName.

## ◆ filePath()

eZImage::filePath | ( |  | $relative = `false` | ) |

Returns the path and filename to the original image.

If $relative is set to true the path is returned relative. Absolute is default.

Definition at line 797 of file ezimage.php.

References $FileName, and file_exists().

Referenced by createWatermark(), delete(), height(), imagePath(), and width().

## ◆ forum()

eZImage::forum | ( |  | $as_object = `true` | ) |

Returns the comments for the image.

Definition at line 1432 of file ezimage.php.

References $category, $db, $forum, $ini, $module, $res, and eZDB\globalDatabase().

## ◆ get()

eZImage::get | ( |  | $id = `""` | ) |

Fetches the object information from the database.

Definition at line 354 of file ezimage.php.

References $db, $id, $ret, eZDB\globalDatabase(), and Name.

## ◆ getAll()

& eZImage::getAll | ( |  | ) |

Returns all the images found in the database.

The images are returned as an array of eZImage objects.

Definition at line 497 of file ezimage.php.

References $category_array, $db, $i, and eZDB\globalDatabase().

## ◆ getByOriginalFileName()

static eZImage::getByOriginalFileName | ( |  | $id = `""` | ) |
| static

Fetches an image from the database if one with the same "original filename" is found.

Definition at line 391 of file ezimage.php.

References $db, $id, $ret, and eZDB\globalDatabase().

## ◆ getUnassigned()

static eZImage::getUnassigned | ( |  | $offset = `-1`,
|  |  | $limit = `-1`
| ) |  |
| static

Get all the images that is not assigned to a category.

The images are returned as an array of eZImage objects.

Definition at line 515 of file ezimage.php.

References $db, $image, $limit, $offset, and eZDB\globalDatabase().

## ◆ hasMap()

eZImage::hasMap | ( |  | ) |

Returns true if the current image has defined an image map.

Definition at line 1416 of file ezimage.php.

References $db, $res, and eZDB\globalDatabase().

## ◆ height()

eZImage::height | ( |  | ) |

Returns the height of the image.

Definition at line 1211 of file ezimage.php.

References $size, file_exists(), and filePath().

## ◆ id()

eZImage::id | ( |  | ) |

Returns the id of the image.

Definition at line 704 of file ezimage.php.

References $ID.

## ◆ imageIDFromForum()

eZImage::imageIDFromForum | ( |  | $ForumID | ) |

Returns the image which a review is connected to.

Definition at line 1505 of file ezimage.php.

References $db, $ImageID, $result, and eZDB\globalDatabase().

## ◆ imagePath()

eZImage::imagePath | ( |  | $relative = `false` | ) |

Same as filePath()

Definition at line 894 of file ezimage.php.

References filePath().

## ◆ isOwner()

static eZImage::isOwner | ( |  | $user,
|  |  | $image
| ) |  |
| static

\Static Returns true if the given user is the owner of the given object. $user is either a userID or an eZUser. $image is the ID of the image.

Definition at line 1274 of file ezimage.php.

References $db, $res, $user, $userID, and eZDB\globalDatabase().

## ◆ keywords()

eZImage::keywords | ( |  | ) |

Returns the photographer og the image

Definition at line 1321 of file ezimage.php.

References $Keywords.

## ◆ name()

& eZImage::name | ( |  | $html = `true` | ) |

Returns the name of the image.

Definition at line 715 of file ezimage.php.

References $Name, $OriginalFileName, eZTextTool\fixhtmlentities(), and Name.

## ◆ originalFileName()

eZImage::originalFileName | ( |  | ) |

Returns the original file name of the image.

Definition at line 771 of file ezimage.php.

References $OriginalFileName.

## ◆ photographer()

eZImage::photographer | ( |  | $as_object = `true` | ) |

Returns the photographer og the image

Definition at line 1302 of file ezimage.php.

References $PhotographerID.

## ◆ products()

eZImage::products | ( |  | ) |

Returns the products that this image is used in.

Definition at line 1350 of file ezimage.php.

References $articles, $db, $i, $res, and eZDB\globalDatabase().

## ◆ randomImage()

static eZImage::randomImage | ( |  | $categoryID = `0` | ) |
| static

Returns a random image from a category.

Definition at line 1371 of file ezimage.php.

References $categoryID, $db, $res, and eZDB\globalDatabase().

## ◆ readPermission()

eZImage::readPermission | ( |  | ) |

Returns the read permission of the eZImage object.

Definition at line 968 of file ezimage.php.

References $ret.

Referenced by checkReadPermission().

## ◆ requestImageVariation()

eZImage::requestImageVariation | ( |  | $width,
|  |  | $height,
|  |  | $convertToGray = `false`,
|  |  | $allow_error = `false`
| ) |  |

Returns the eZImageVariation object to a scaled version of the image. If the scaled version does not exist it is created.

The required image variation group is also created if it does not exist.

The path to the file is returned.

False is returned if the original image does not exist.

Definition at line 909 of file ezimage.php.

References $group, $height, $ret, $variation, and $width.

## ◆ search()

static eZImage::search | ( | & | $queryText,
|  |  | $offset = `0`,
|  |  | $limit = `30`,
|  |  | $userID = `-1`
| ) |  |
| static

Searches the database for images.

Definition at line 221 of file ezimage.php.

References $db, $file, $group, $limit, $offset, $query, $ret, $user, $userID, eZUser\currentUser(), and eZDB\globalDatabase().

## ◆ searchCount()

static eZImage::searchCount | ( |  | $name,
|  |  | $literal = `false`
| ) |  |
| static

Searches the database for images.

Definition at line 269 of file ezimage.php.

References $db, $group, $name, $query, $ret, $user, $userID, eZUser\currentUser(), and eZDB\globalDatabase().

## ◆ setCaption()

eZImage::setCaption | ( |  | $value | ) |

Sets the image caption.

Definition at line 1022 of file ezimage.php.

## ◆ setCategoryDefinition()

eZImage::setCategoryDefinition | ( |  | $value | ) |

Set's the images defined category. This is the main category for the image. Additional categories can be added with eZImageCategory::addImage();

Definition at line 437 of file ezimage.php.

References $categoryID, $db, $query, $res, and eZDB\globalDatabase().

## ◆ setDescription()

eZImage::setDescription | ( |  | $value | ) |

Sets the image description.

Definition at line 1030 of file ezimage.php.

## ◆ setImage()

eZImage::setImage | ( | & | $file | ) |

Makes a copy of the image and stores the image in the catalogue.

If the image is not of the type .jpg or .gif the image is converted to .jpg.

Definition at line 1063 of file ezimage.php.

References $file, $name, $suffix, file_exists(), and eZPBImageFile\information().

## ◆ setKeywords()

eZImage::setKeywords | ( |  | $keywords | ) |

Sets the keywords of the image

Definition at line 1310 of file ezimage.php.

## ◆ setName()

eZImage::setName | ( |  | $value | ) |

Sets the image name.

Definition at line 1014 of file ezimage.php.

References Name.

## ◆ setOriginalFileName()

eZImage::setOriginalFileName | ( |  | $value | ) |

Sets the original imagename.

Definition at line 1038 of file ezimage.php.

## ◆ setPhotographer()

eZImage::setPhotographer | ( |  | $author | ) |

Sets the photographer of the image

Definition at line 1291 of file ezimage.php.

References $author.

## ◆ setReadPermission()

eZImage::setReadPermission | ( |  | $value | ) |

Sets the read permission of the eZImage object.

1 = User 2 = Group 3 = All

Definition at line 1152 of file ezimage.php.

## ◆ setUser()

eZImage::setUser | ( |  | $user | ) |

Sets the user of the eZImage object.

Definition at line 1184 of file ezimage.php.

References $user, and $userID.

## ◆ setWritePermission()

eZImage::setWritePermission | ( |  | $value | ) |

Sets the writePermission permission of the eZImage object.

1 = User 2 = Group 3 = All

Definition at line 1115 of file ezimage.php.

## ◆ store()

eZImage::store | ( |  | ) |

Stores a eZImage object to the database.

Definition at line 116 of file ezimage.php.

References $db, $name, $res, $variation, eZDB\globalDatabase(), Name, and variations().

## ◆ user()

eZImage::user | ( |  | ) |

Returns a eZUser object.

Definition at line 1000 of file ezimage.php.

References $ret.

## ◆ variations()

eZImage::variations | ( |  | ) |

Returns every variation to a image as a array of eZVariation objects.

Definition at line 1225 of file ezimage.php.

References $db, $variation, and eZDB\globalDatabase().

Referenced by delete(), and store().

## ◆ watermarkPath()

& eZImage::watermarkPath | ( |  | $relative = `false` | ) |

Definition at line 822 of file ezimage.php.

References $FileName, createWatermark(), and file_exists().

## ◆ width()

eZImage::width | ( |  | ) |

Returns the width of the image.

Definition at line 1197 of file ezimage.php.

References $size, file_exists(), and filePath().

## ◆ writePermission()

eZImage::writePermission | ( |  | ) |

Returns the writePermission permission of the eZImage object.

Definition at line 936 of file ezimage.php.

References $ret.

Referenced by checkWritePermission().

## Member Data Documentation

## ◆ $Caption

eZImage::$Caption

Definition at line 1524 of file ezimage.php.

Referenced by caption().

## ◆ $Description

eZImage::$Description

Definition at line 1525 of file ezimage.php.

Referenced by description().

## ◆ $FileName

eZImage::$FileName

Definition at line 1526 of file ezimage.php.

Referenced by createWatermark(), fileExists(), fileName(), filePath(), and watermarkPath().

## ◆ $ID

eZImage::$ID

Definition at line 1522 of file ezimage.php.

Referenced by __construct(), and id().

## ◆ $Keywords

eZImage::$Keywords

Definition at line 1533 of file ezimage.php.

Referenced by keywords().

## ◆ $Name

eZImage::$Name

Definition at line 1523 of file ezimage.php.

Referenced by name().

## ◆ $NewImage

eZImage::$NewImage

Definition at line 1532 of file ezimage.php.

## ◆ $OriginalFileName

eZImage::$OriginalFileName

Definition at line 1527 of file ezimage.php.

Referenced by name(), and originalFileName().

## ◆ $PhotographerID

eZImage::$PhotographerID

Definition at line 1531 of file ezimage.php.

Referenced by photographer().

## ◆ $ReadPermission

eZImage::$ReadPermission

Definition at line 1528 of file ezimage.php.

## ◆ $UserID

eZImage::$UserID

Definition at line 1530 of file ezimage.php.

## ◆ $WritePermission

eZImage::$WritePermission

Definition at line 1529 of file ezimage.php.

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

- ezimage.php

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