eZ Publish  [4.2]
eZImageAliasHandler Class Reference

Internal manager for the eZImage datatype. More...

List of all members.

Public Member Functions

 addImageAlias ($imageAlias)
 addImageAliases ($imageAliasList)
 addImageAliasToXML ($domTree, $imageAlias)
 attribute ($attributeName)
attributeFromOriginal ($attributeName)
 attributes ()
 createImageInformationNode ($imageNode, $mimeData)
 directoryPath ()
 displayText ($alternativeText=null)
 domTree ()
 eZImageAliasHandler ($contentObjectAttribute)
 generateXMLData ()
 hasAttribute ($attributeName)
 httpFile ($release=false)
 Returns the stored HTTP file object or false if no object is stored.
 imageAlias ($aliasName)
 imageName ($contentObjectAttribute, $contentVersion, $language=false)
 imageNameByNode ($contentObjectAttribute, $mainNode, $language=false)
 imagePath ($contentObjectAttribute, $contentVersion, $isImageOwner=null)
 imagePathByNode ($contentObjectAttribute, $mainNode)
 imageSerialNumber ()
 increaseImageSerialNumber ()
 initialize ($mimeData, $originalFilename, $imageAltText=false)
 initializeFromFile ($filename, $imageAltText=false, $originalFilename=false)
 initializeFromHTTPFile ($httpFile, $imageAltText=false)
 Initializes the content object attribute with the uploaded HTTP file.
 isImageOwner ()
 isStorageRequired ()
 originalAttributeData ()
 removeAliases ($contentObjectAttribute)
 Removes all the image aliases and their information.
 resetImageSerialNumber ()
 setAttribute ($attributeName, $attributeValue)
 setDOMTree ($domTree)
 setHTTPFile ($httpFile)
 Sets the uploaded HTTP file object to $httpFile.
 setImageSerialNumber ($val)
 setOriginalAttributeData ($originalData)
 setOriginalAttributeDataFromAttribute ($contentObjectAttribute)
 setOriginalAttributeDataValues ($attributeID, $attributeVersion, $attributeLanguage)
 setStorageRequired ($require=true)
 store ($contentObjectAttribute)
 storeDOMTree ($domTree, $storeAttribute, $contentObjectAttributeRef)
 updateAliasPath ($dirpath, $name)

Static Public Member Functions

 normalizeImageName ($imageName)
static removeAllAliases ($contentObjectAttribute)
 Removes all image alias files which the attribute refers to.

Public Attributes

 $ContentObjectAttribute
 Deprecated. Contains a reference to the object attribute.
 $ContentObjectAttributeData
 Contains a some eZContentObjectAttribute's attributes.

Protected Member Functions

 setAliasAttribute ($aliasName, $attributeName, $value)
 setAliasList ($aliasList)
 setAliasVariation ($aliasName, $variation)

Private Member Functions

 aliasList ()
 createOriginalAttributeXMLData ($originalNode, $originalData)
 imageSerialNumberRaw ()
 parseInformationNode ($imageInfoNode)
 recreateDOMTree ()

Detailed Description

Internal manager for the eZImage datatype.

Takes care of image conversion and serialization from and to the internal XML format.

Note:
This handler was introduced in eZ Publish 3.3 and will detect older eZImage structures and convert them on the fly.
The XML storage was improved in 3.8, from then it always stores the attribute ID, version and language in the <original> tag. This was required to get the new multi-language features to work.

Definition at line 47 of file ezimagealiashandler.php.


Member Function Documentation

eZImageAliasHandler::addImageAlias ( imageAlias)

Adds the image alias structure $imageAlias to the content object attribute.

Definition at line 1369 of file ezimagealiashandler.php.

eZImageAliasHandler::addImageAliases ( imageAliasList)

Adds all the new image alias structures in $imageAliasList to the content object attribute.

Definition at line 1351 of file ezimagealiashandler.php.

Referenced by imageAlias().

eZImageAliasHandler::addImageAliasToXML ( domTree,
imageAlias 
)

Adds the image alias structure $imageAlias to the XML DOM document $domTree.

Definition at line 1381 of file ezimagealiashandler.php.

Referenced by addImageAlias(), addImageAliases(), and recreateDOMTree().

eZImageAliasHandler::aliasList ( ) [private]
Returns:
A list of aliases structures for the current attribute.ezxml

The first this is called the XML data will be parsed into the internal structures. Subsequent calls will simply return the internal structure.

Definition at line 508 of file ezimagealiashandler.php.

Referenced by directoryPath(), imageAlias(), recreateDOMTree(), removeAliases(), setAttribute(), and updateAliasPath().

eZImageAliasHandler::attribute ( attributeName)
Returns:
the value of the attribute named $attributeName. See eZImageAliasHandler::attributes() for which attributes are available.

Definition at line 114 of file ezimagealiashandler.php.

Referenced by attributeFromOriginal(), displayText(), imageName(), and imageNameByNode().

& eZImageAliasHandler::attributeFromOriginal ( attributeName)
Returns:
The value of the attribute named $attributeName from the 'original' image alias.

This is a quick way for extracting information from the 'original' image alias.

Definition at line 132 of file ezimagealiashandler.php.

Referenced by attribute().

eZImageAliasHandler::attributes ( )

Lists all available image aliases as attributes as well as:

  • alternative_text - The alternative text input by the user, can be empty
  • original_filename - The name of image which it had on the users disk before it was uploaded
  • is_valid - A boolean which says if there is an image here or not.

Definition at line 81 of file ezimagealiashandler.php.

eZImageAliasHandler::createImageInformationNode ( imageNode,
mimeData 
)

Definition at line 1270 of file ezimagealiashandler.php.

Referenced by generateXMLData(), initialize(), and recreateDOMTree().

eZImageAliasHandler::createOriginalAttributeXMLData ( originalNode,
originalData 
) [private]

Creates XML attributes containing information on the original image attribute.

The new attributes will be appended to $originalNode.

Definition at line 873 of file ezimagealiashandler.php.

Referenced by initialize(), recreateDOMTree(), and setOriginalAttributeData().

eZImageAliasHandler::directoryPath ( )
Returns:
The full directory path to the image, this includes the var and storage directory.

Definition at line 246 of file ezimagealiashandler.php.

eZImageAliasHandler::displayText ( alternativeText = null)
Returns:
A text string which can be used as display for the image.

The text string will either contain the alternative text from the attribute or the parameter $alternativeText if it is set.

Definition at line 233 of file ezimagealiashandler.php.

Referenced by aliasList(), imageAlias(), and setAttribute().

eZImageAliasHandler::domTree ( )
Returns:
the DOM tree for the current content object attribute.
Note:
It will cache the result in the DataTypeCustom member variable of the content object attribute in the 'dom_tree' key.

Definition at line 953 of file ezimagealiashandler.php.

Referenced by addImageAlias(), addImageAliases(), setOriginalAttributeData(), and store().

eZImageAliasHandler::eZImageAliasHandler ( contentObjectAttribute)

Creates the handler and creates a reference to the contentobject attribute that created it.

Definition at line 52 of file ezimagealiashandler.php.

eZImageAliasHandler::generateXMLData ( )

Creates default information.

Definition at line 1623 of file ezimagealiashandler.php.

Referenced by aliasList(), and domTree().

eZImageAliasHandler::hasAttribute ( attributeName)
Returns:
true if the attribute named $attributeName exists. See eZImageAliasHandler::attributes() for which attributes are available.

Definition at line 96 of file ezimagealiashandler.php.

eZImageAliasHandler::httpFile ( release = false)

Returns the stored HTTP file object or false if no object is stored.

Parameters:
bool$releaseErase the content of the stored HTTP file
See also:
setHTTPFile

Definition at line 1079 of file ezimagealiashandler.php.

eZImageAliasHandler::imageAlias ( aliasName)
Returns:
The image alias structure for the alias named $aliasName.

This will create the image alias if it does not exist yet, this can involve running image operations to for instance scale the image.

Definition at line 415 of file ezimagealiashandler.php.

Referenced by attribute().

eZImageAliasHandler::imageName ( contentObjectAttribute,
contentVersion,
language = false 
)
Returns:
A normalized name for the image.

The image name will generated from the name of the current version. If this is empty it will use the object name or the alternative text.

This ensures that the image has a name which corresponds to the object it belongs to.

The normalization ensures that the name only contains filename and URL friendly characters.

Definition at line 266 of file ezimagealiashandler.php.

Referenced by initializeFromFile(), and initializeFromHTTPFile().

eZImageAliasHandler::imageNameByNode ( contentObjectAttribute,
mainNode,
language = false 
)
Returns:
A normalized name for the image based on a node.

Similar to imageName() but fetches name information from the node $mainNode.

The normalization ensures that the name only contains filename and URL friendly characters.

Definition at line 305 of file ezimagealiashandler.php.

eZImageAliasHandler::imagePath ( contentObjectAttribute,
contentVersion,
isImageOwner = null 
)
Returns:
The storage path for the image.

The path is calculated by using information from the current object and version. If the object is in the node tree it will contain a path that matches the node path, if not it will be placed in the versioned storage repository.

Definition at line 338 of file ezimagealiashandler.php.

Referenced by initializeFromFile(), and initializeFromHTTPFile().

eZImageAliasHandler::imagePathByNode ( contentObjectAttribute,
mainNode 
)
Returns:
The storage path for the image based on a node.

Similar to imagePath() but fetches name information from the node $mainNode.

Definition at line 388 of file ezimagealiashandler.php.

eZImageAliasHandler::imageSerialNumber ( )
Returns:
The current serial number, the value will be 1 or higher.

The serial number is used to create unique filenames for uploaded images, it will be increased each time an image is uploaded.

Note:
This was required to get around the problem where browsers caches image information, if two images were uploaded in one version (e.g. a draft) the browser would not load the new image since it thought it had not changed.

Definition at line 201 of file ezimagealiashandler.php.

Referenced by imageName(), initialize(), and recreateDOMTree().

eZImageAliasHandler::imageSerialNumberRaw ( ) [private]
Returns:
The internal serial number.

It will check if a serial number exists and return that, if not a new one will be created and returned.

Definition at line 1613 of file ezimagealiashandler.php.

Referenced by imageSerialNumber(), and increaseImageSerialNumber().

eZImageAliasHandler::increaseImageSerialNumber ( )

Increases the serial by one.

Definition at line 214 of file ezimagealiashandler.php.

Referenced by initializeFromFile(), and initializeFromHTTPFile().

eZImageAliasHandler::initialize ( mimeData,
originalFilename,
imageAltText = false 
)

Makes sure the attribute contains the image file mentioned in $mimeData. This involves removing any previous image (and image aliases), increasing the image name counter, figuring out the image size and creating the internal XML structure.

Returns:
true on success.

Definition at line 1188 of file ezimagealiashandler.php.

Referenced by initializeFromFile(), and initializeFromHTTPFile().

eZImageAliasHandler::initializeFromFile ( filename,
imageAltText = false,
originalFilename = false 
)

Initializes the content object attribute $contentObjectAttribute with the filename $filename. Optionally you may also specify the alternative text in the parameter $imageAltText.

See also:
initialize

Definition at line 1139 of file ezimagealiashandler.php.

eZImageAliasHandler::initializeFromHTTPFile ( httpFile,
imageAltText = false 
)

Initializes the content object attribute with the uploaded HTTP file.

Parameters:
eZHTTPFile$httpFile
string$imageAltTextOptional image ALT text
Returns:
TODO: FIXME

Definition at line 1102 of file ezimagealiashandler.php.

eZImageAliasHandler::isImageOwner ( )
Returns:
true if this is considered to be owner of the image.

It will be considered an owner if attribute data is not a copy of another attribute. For instance each time a new image is uploaded this will return true.

Definition at line 181 of file ezimagealiashandler.php.

Referenced by imagePath(), removeAliases(), and updateAliasPath().

eZImageAliasHandler::isStorageRequired ( )
Returns:
true if the image alias handler is required to store it's contents.
See also:
setStorageRequired, store

Definition at line 1507 of file ezimagealiashandler.php.

eZImageAliasHandler::normalizeImageName ( imageName) [static]

Normalized the image name $imageName by removing all characters that are not considered filename or URL friendly. The filename will also be in non-capital letters.

Definition at line 1048 of file ezimagealiashandler.php.

Referenced by imageName(), and imageNameByNode().

eZImageAliasHandler::originalAttributeData ( )
Returns:
An array structure with information on which attribute originally created the current data.

This will only contain data if the attribute is a copy of another attribute, e.g in the case of a new version without an new image upload.

Definition at line 1530 of file ezimagealiashandler.php.

Referenced by imagePath(), imagePathByNode(), initialize(), isImageOwner(), and recreateDOMTree().

eZImageAliasHandler::parseInformationNode ( imageInfoNode) [private]

Parses the information node and generates the internal information structures.

The information node contains information from the image itself, for instance EXIF data from a JPEG or TIFF image.

Parameters:
$imageInfoNode
Returns:
$imageInformation array

Definition at line 987 of file ezimagealiashandler.php.

Referenced by aliasList().

eZImageAliasHandler::recreateDOMTree ( ) [private]

Recreates the DOM tree from the internal array structures and stores the DOM tree in the 'data_text' field of the attribute.

Definition at line 885 of file ezimagealiashandler.php.

Referenced by setAttribute(), and updateAliasPath().

eZImageAliasHandler::removeAliases ( contentObjectAttribute)

Removes all the image aliases and their information.

The stored images will also be removed if the attribute is the owner of the images.

After the images are removed the attribute will containe an internal structure with empty data

Parameters:
eZContentObjectAttribute$contentObjectAttributeContent object attribute to remove aliases for
Returns:
void

Definition at line 716 of file ezimagealiashandler.php.

Referenced by initializeFromFile(), and initializeFromHTTPFile().

static eZImageAliasHandler::removeAllAliases ( contentObjectAttribute) [static]

Removes all image alias files which the attribute refers to.

Parameters:
eZContentObjectAttribute
Note:
If you want to remove the alias information use removeAliases().

Definition at line 674 of file ezimagealiashandler.php.

Referenced by eZImageType\deleteStoredObjectAttribute().

eZImageAliasHandler::resetImageSerialNumber ( )

Resets the serial number to zero.

Definition at line 222 of file ezimagealiashandler.php.

Referenced by updateAliasPath().

eZImageAliasHandler::setAliasAttribute ( aliasName,
attributeName,
value 
) [protected]

Set alias value.

Parameters:
aliasNamealias name
attributeNameattribute name
valueattribute value

Definition at line 496 of file ezimagealiashandler.php.

Referenced by addImageAliases(), and setAttribute().

eZImageAliasHandler::setAliasList ( aliasList) [protected]

Set alias list. Set alias list to current object

Parameters:
aliasListalias list

Definition at line 473 of file ezimagealiashandler.php.

Referenced by aliasList(), imageAlias(), and initialize().

eZImageAliasHandler::setAliasVariation ( aliasName,
variation 
) [protected]

Definition at line 484 of file ezimagealiashandler.php.

Referenced by updateAliasPath().

eZImageAliasHandler::setAttribute ( attributeName,
attributeValue 
)

Sets the attribute named $attributeName to have the value $attributeValue.

The following attributes can be set:

  • alternative text
  • original_filename

Definition at line 148 of file ezimagealiashandler.php.

eZImageAliasHandler::setDOMTree ( domTree)

Sets the XML DOM document $domTree as the current DOM document.

Definition at line 1431 of file ezimagealiashandler.php.

Referenced by initialize(), recreateDOMTree(), and setOriginalAttributeDataFromAttribute().

eZImageAliasHandler::setHTTPFile ( httpFile)

Sets the uploaded HTTP file object to $httpFile.

This object is used to store information about the image file until the content object attribute is to be stored.

Parameters:
mixed$httpFile
See also:
httpFile

Definition at line 1067 of file ezimagealiashandler.php.

eZImageAliasHandler::setImageSerialNumber ( val)

Set internal serial number

Parameters:
valvalue

Definition at line 1602 of file ezimagealiashandler.php.

Referenced by aliasList(), increaseImageSerialNumber(), and resetImageSerialNumber().

eZImageAliasHandler::setOriginalAttributeData ( originalData)

Sets the information on which attribute the data was fetched from. See eZImageAliasHandler::originalAttributeData() for more information.

Definition at line 1547 of file ezimagealiashandler.php.

Referenced by aliasList(), originalAttributeData(), setOriginalAttributeDataFromAttribute(), and setOriginalAttributeDataValues().

eZImageAliasHandler::setOriginalAttributeDataFromAttribute ( contentObjectAttribute)

Sets the information on which attribute the data was fetched from.

Fetches data from the contentobject attribute $contentObjectAttribute and sets it using setOriginalAttributeData().

Definition at line 1566 of file ezimagealiashandler.php.

eZImageAliasHandler::setOriginalAttributeDataValues ( attributeID,
attributeVersion,
attributeLanguage 
)

Sets the information on which attribute the data was fetched from.

Fetches data from the parameters and sets it using setOriginalAttributeData().

Definition at line 1590 of file ezimagealiashandler.php.

Referenced by initialize(), initializeFromFile(), initializeFromHTTPFile(), and setOriginalAttributeDataFromAttribute().

eZImageAliasHandler::setStorageRequired ( require = true)

Sets whether storage of the image alias data is required or not.

See also:
isStorageRequired, store

Definition at line 1518 of file ezimagealiashandler.php.

Referenced by setAttribute(), store(), and updateAliasPath().

eZImageAliasHandler::store ( contentObjectAttribute)

Stores the data in the image alias handler to the content object attribute.

See also:
isStorageRequired, setStorageRequired

Definition at line 1481 of file ezimagealiashandler.php.

eZImageAliasHandler::storeDOMTree ( domTree,
storeAttribute,
contentObjectAttributeRef 
)

Stores the XML DOM document $domTree to the content object attribute.

Definition at line 1440 of file ezimagealiashandler.php.

Referenced by addImageAlias(), addImageAliases(), generateXMLData(), removeAliases(), and store().

eZImageAliasHandler::updateAliasPath ( dirpath,
name 
)

Will update the path for images to point to the new path $dirpath and filename $name.

This is usually called when the object contain the image attribute is moved in the tree.

Definition at line 820 of file ezimagealiashandler.php.


Member Data Documentation

eZImageAliasHandler::$ContentObjectAttribute

Deprecated. Contains a reference to the object attribute.

Definition at line 1661 of file ezimagealiashandler.php.

eZImageAliasHandler::$ContentObjectAttributeData

Contains a some eZContentObjectAttribute's attributes.

Definition at line 1659 of file ezimagealiashandler.php.


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