This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Blogger's image in each blog post

Blogger's image in each blog post

Blogger's image in each blog post

Wednesday 07 March 2012 9:50:10 am - 9 replies

Hello EzCommunity;

I tend to create a blog. In my site there are 10 bloggers who update this blog.

But in each blog post each blogger has his own image. and they should be able to update the blog from anywhere , without adding their image each time.

I thought i have to add another "blog-post" with my own design but i dont know how to put the blogger's image?

if i put an image attribute class they need to upload their image each time from outside of ez publish which is not my goal!Can anyone please help me how to do it?

Thank you very much!

Wednesday 07 March 2012 10:17:35 am

Hi Yara,

Aren't bloggers associated with user accounts? There is already an image attribute in the eZ Publish User class which bloggers can use to upload their own image. They will only have to do this once. Then, each time they want to post on the blog, they authenticate with their user account, having their associated image already stored in the system. Finally, for each blog post you can display the image of the author (the blogger) who created the post.

Hope it helps.

Wednesday 07 March 2012 10:31:23 am

Hello Bogdan ; 

Thank you very much for your response,

that's exactely what i was looking for! but i dont find this image attribute that u said. what is it's name?

_ Should i add this attribute class to my blog post in Classes? then modify it in full/templates? 

_and should i write this blog in Section part? 

Thank you very much!

Wednesday 07 March 2012 11:05:51 am

Hi Yara,

when dumping a node in a full view template, you are able to retrieve the user contentobject (which is an instance of the User class) with :


Then, just check what you have in .data_map in order to know what's the attribute identifier used by the User class to store the avatar


In a default eZ Publish installation, the attribute is image


Last, to display the avatar, just use the attribute_view_gui template function

{attribute_view_gui attribute=$node.object.owner.data_map.image image_class='small'}

Hope this helps,


Wednesday 07 March 2012 11:24:15 am

Hi again Yara,

It's best that you have the image attribute in the User class. If you don't have this attribute on your eZ Publish installation you can add it yourself. In the admin site, go to Setup tab / Classes / Users / User , edit this class and add a new "Image" type attribute. 

There is no point in adding the image attribute to your blog post class, since blog posts are related to bloggers (user accounts) and it's much more efficient to add this attribute to the User class. 

Then, in order to display the blogger picture you should modify your full view template for blog posts and add something like this : 

{attribute_view_gui attribute=$node.object.owner.data_map.image image_class=small}

where :

 $node represents the blog post node

 image represents the identifier of the image attribute you added to the User class.

Wednesday 07 March 2012 11:47:32 am


Arnaud, Bogdabn , Thank you very very MUCH 

But just the last and very important question:

I have to create the user account for each blogger. I have to put blogger's images(two images) in media and they have to choose their image from media! I mean they should not upload anything outside of ezpublish!

Is it possible? because from image attribute class you can just upload ur image from outside of ezpublish and its really important for me to insert just from inside of ez!

Thank you again VERY MUCH

Wednesday 07 March 2012 12:09:20 pm

Well, if you want to do that, create an object relations attribute in your User class, let's say 'avatar'.

Then you'll be able to do quite the same as suggested before. $node.data_map.avatar.content should give you a list of relations (probably a list of content object ids, i can't remember) or something similar (play with the |attribute(show,1) template operator to inspect your resources and dig into the objects). Use this ids list to fetch the avatars object and display the image stored within this content object using attribute_view_gui (the attribute parameter passed to this function must be an ezcontentobjectattribute instance).

Not tested but the code may look like this :

{foreach $node.data_map.avatar.content.relation_list as $relation}
    {def $image_object = fetch('content','object',hash( 'object_id', $ ))}
    {attribute_view_gui attribute=$image_object.data_map.image image_class='medium'}
    {undef $image_object}

Notes :

  • not sure if ...avatar.content will contain a relation_list index but it's something equivalent
  • not sure of the $ so just inspect $relation to get the good index

Hope this helps,


Wednesday 07 March 2012 12:15:32 pm

I will try then! thank you so much 

Wednesday 07 March 2012 6:06:51 pm

Hi Arnaud

Sorry to disturb you again ;

But i have tried so many times, i changed it a bit but the code is not working

Have you got any idea?

Thursday 08 March 2012 10:50:49 am

What do you have in your debug output ?


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

36 542 Users on board!

Forums menu

Proudly Developed with from