The ezimage datatype (Image)
Class eZImageType in kernel/classes/datatypes/ezimage/ezimagetype.php; identifier ezimage, listed in settings/content.ini [DataTypeSettings] AvailableDataTypes[].
What it stores
The columns of the attribute tables its class reads or writes: data_int1, data_int2, data_text (data_text, data_int, data_float and sort_key_* are the object attribute's; data_text1 ... data_int4 the class attribute's settings). Found by reading the class: a heuristic.
It is can be filled from an uploaded file.
In templates
my_attribute stands for the identifier of an attribute of this type in your class:
def $attribute = $node.data_map.my_attribute
if $attribute.has_content
attribute_view_gui attribute=$attribute
/if
{* the value as the datatype returns it (objectAttributeContent()) *}
$attribute.content|attribute( show, 1 )The shipped template that shows it (attribute_view_gui), design/standard/templates/content/datatype/view/ezimage.tpl (first 25 lines):
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{*
Input:
image_class - Which image alias to show, default is large
css_class - Optional css class to wrap around the <img> tag, the
class will be placed in a <div> tag.
alignment - How to align the image, use 'left', 'right' or false().
link_to_image - boolean, if true the url_alias will be fetched and
used as link.
href - Optional string, if set it will create a <a> tag
around the image with href as the link.
border_size - Size of border around image, default is 0
*}
{default image_class=large
css_class=false()
alignment=false()
link_to_image=false()
href=false()
target=false()
hspace=false()
border_size=0
border_color=''
border_style=''
margin_size=''
alt_text=''The shipped template that edits it (attribute_edit_gui), design/standard/templates/content/datatype/edit/ezimage.tpl (first 25 lines):
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
default attribute_base='ContentObjectAttribute'
let attribute_content=$attribute.content
def $alt_text_required = $attribute.contentclass_attribute.data_int2|eq( 1 )
{* Current image. *}
<div class="block">
<label>'Current image'|i18n( 'design/standard/content/datatype' ):</label>
if $attribute_content.original.is_valid
<table class="list" cellspacing="0">
<tr>
<th class="tight">'Preview'|i18n( 'design/standard/content/datatype' )</th>
<th>'Filename'|i18n( 'design/standard/content/datatype' )</th>
<th>'MIME type'|i18n( 'design/standard/content/datatype' )</th>
<th>'Size'|i18n( 'design/standard/content/datatype' )</th>
</tr>
<tr>
<td>attribute_view_gui image_class=ezini( 'ImageSettings', 'DefaultEditAlias', 'content.ini' ) attribute=$attribute</td>
<td>$attribute.content.original.original_filename|wash( xhtml )</td>
<td>$attribute.content.original.mime_type|wash( xhtml )</td>
<td>$attribute.content.original.filesize|si( byte )</td>
</tr>
</table>
elseOverride them for one class attribute in an override.ini.append.php with Source=content/datatype/view/ezimage.tpl and a match on attribute_identifier (see A template override).
Related
Generated by ./console exp:help:examples from kernel/classes/datatypes/ezimage/ezimagetype.php, settings/content.ini, design/standard/templates/content/datatype/view/ezimage.tpl, design/standard/templates/content/datatype/edit/ezimage.tpl. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.