Forum Discussion

steffenschoene's avatar
6 years ago

How to Display Node Avatars?

Hi,

how can I display in frontend the Avatar of a Category/Board if someone set one in the admin backend? Is there a widget/component to show that or can I get the URL by an API Call?

Greetings
Steffen

 

  • AmyS's avatar
    AmyS
    6 years ago

    Correct. Node avatar was added as part of the Group Hubs feature, but should work on any node.

     

    As you say, it may not be in the docs yet, but looking at internal builds I believe that if you see it in admin, it's available to use via its component: 

     

    <component id="nodes.widget.avatar"/>

7 Replies

  • steffenschoene,

    You can use below API to get the image attached to category properties.

    <a href="http://community.url.com/community-name/restapi/vc/categories/id/category_id/avatar" target="_blank">http://community.url.com/community-name/restapi/vc/categories/id/category_id/avatar</a>

     

    Where avatar at the end is the value of text-key to the node.

  • steffenschoene's avatar
    steffenschoene
    Expert
    6 years ago

    Hi Parshant ,

    thanks for the quick response. I already tried this path but I get this error. Maybe I did something wrong? I already double checked the avatar on that node.

    REST Error:
     path="https://community.url.com/community-name/restapi/vc/categories/id/Programm-Bereiche/avatar?restapi.response_style=view"
     status="error"
     code="501"
     message="Unknown path element at node 'category'."

    Greetings
    Steffen 

  • mbiel's avatar
    mbiel
    Expert
    6 years ago

    I would also be very interested in a solution for this. Why is there an option in the admin backend to add such an image if we are not able to show it anywhere?

    As mentioned by steffenschoene , the approach with the API V1 call does not work.
    There is also no 'avatar' mentioned in docs (neither for categories nor boards or nodes):
    https://devdocportal.lithium.com/t5/Community-API-v1-Reference/bd-p/restv1docs?section=commv1&branch=Category
    https://devdocportal.lithium.com/t5/Community-API-v2-Reference/bd-p/restv2docs?section=commv2&collection=categories

  • I'm pretty sure this is part of the Group Hub beta, or recall it was introduced for that (I could be off).  As it's still in beta/EA, it wouldn't be in the docs yet.

  • AmyS's avatar
    AmyS
    Khoros Alumni (Retired)
    6 years ago

    Correct. Node avatar was added as part of the Group Hubs feature, but should work on any node.

     

    As you say, it may not be in the docs yet, but looking at internal builds I believe that if you see it in admin, it's available to use via its component: 

     

    <component id="nodes.widget.avatar"/>

  • mbiel's avatar
    mbiel
    Expert
    6 years ago

    Thanks AmyS  and StanGromer! I supposed that this is maybe related to group hubs but thanks for this component, it works! 🙂

  • AmyS's avatar
    AmyS
    Khoros Alumni (Retired)
    6 years ago

    Hi johnsmith101 

     

    I'm not sure which steps you've tried, so a few questions:

    1. Do you have node avatars enabled on your community? It's a setting that may still require filing a request to support to turn on right now. 

    2. If you do have the setting enabled, did you set an image on a node? 

    3. Which template/quilt did you place the component? 

     

    Thanks