How should i handle images in template ?

How should i handle images in template ?

Tuesday 03 October 2006 10:45:39 am - 4 replies

Author Message

Łukasz Serwatka

Tuesday 03 October 2006 11:44:23 pm

All image settings you can find in settings/image.ini. File that contains comments, so you should quickly figure out how to add new image aliases and so on. Don't change default file, use global override or per siteaccess. Create new file image.ini.append.php under settings/override or settings/siteaccess/(your_site_access)

If your content class attribute is image datatype then you can display it using

{attribute_view_gui attribute=$node.object.data_map.image image_class=large} where image class equals to aliases in your override image.ini.append.php

See also template design/standard/templates/content/datatype/view/ezimage.tpl for list all available parameters.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Dominic Mercier

Thursday 05 October 2006 12:43:49 pm

I still can't display any image. I must have missed something important.

Here's my template code:

{attribute_view_gui attribute=$node.object.data_map.image image_class=large}
{$node.object.data_map.image|attribute(show, 1)}

Here's the output without any image
<i>
Attribute Type Value
id string 195
contentobject_id string 58
version string 2
language_code string 'eng-CA'
language_id string 2
contentclassattribute_id string 154
attribute_original_id string 0
sort_key_int string 57
sort_key_string string ''
data_type_string string 'ezobjectrelation'
data_text string ''
data_int string 57
data_float string 0
contentclass_attribute object[ezcontentclassattribute] Object
contentclass_attribute_identifier string 'image'
contentclass_attribute_name string 'Image'
can_translate integer 1
is_information_collector string 0
is_required string 0
content object[ezcontentobject] Object
has_http_value boolean false
value object[ezcontentobject] Object
has_content boolean true
class_content array Array(3)
object object[ezcontentobject] Object
object_version object[ezcontentobjectversion] Object
view_template string 'ezobjectrelation'
edit_template string 'ezobjectrelation'
result_template string 'ezobjectrelation'
has_validation_error boolean false
validation_error NULL
validation_log NULL
language object[ezcontentobjectattribute] Object
is_a string 'ezobjectrelation'
display_info array Array(4)
class_display_info array Array(2)
</i>

The object datatype seems to be valid.
There is no warnings or errors in debug
What else can i check ?? :)

Thanks !! :P

Łukasz Serwatka

Thursday 05 October 2006 12:56:17 pm

Hi Dominic,

Your image attribute is ezobjectrelation type, this means that holds relation to other object. You need to access your image like this:

{attribute_view_gui attribute=$node.object.data_map.image.content.data_map.image image_class=large}

So .content holds that related object information.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Dominic Mercier

Friday 06 October 2006 7:29:55 am

Hi, thanks for helping me :)

Guess what.. It still doesn't display the image ><
This seems so basic and i can't generate a tiny img tag ><

Here's my code again :P
<b>Template code</b>

{attribute_view_gui 
attribute=$node.object.data_map.image.content.data_map.image 
image_class=large}
{$node.object.data_map.image.content.data_map.image|attribute(show, 1)}

<b>Output</b>
<i>
Attribute Type Value
id string 188
contentobject_id string 57
version string 1
language_code string 'eng-CA'
language_id string 3
contentclassattribute_id string 118
attribute_original_id string 0
sort_key_int string 0
sort_key_string string ''
data_type_string string 'ezimage'
data_text string ' '
data_int NULL
data_float string 0
contentclass_attribute object[ezcontentclassattribute] Object
contentclass_attribute_identifier string 'image'
contentclass_attribute_name string 'Image'
can_translate integer 1
is_information_collector string 0
is_required string 0
content object[ezimagealiashandler] Object
has_http_value boolean false
value object[ezimagealiashandler] Object
has_content string 1
class_content string ''
object object[ezcontentobject] Object
object_version object[ezcontentobjectversion] Object
view_template string 'ezimage'
edit_template string 'ezimage'
result_template string 'ezimage'
has_validation_error boolean false
validation_error NULL
validation_log NULL
language object[ezcontentobjectattribute] Object
is_a string 'ezimage'
display_info array Array(4)
class_display_info array Array(2)
</i>

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.