Forum Discussion

qinglau's avatar
qinglau
Mentor
11 years ago

Check whether users have upload avatar

Hello Guys,

 

I am trying to build a function to check whether users have upload their own avatar img. Is there a way to do that? Currently, I am using REST API to grab user avatar URL

 

I noticed that the avatar URL are difference between the stock collection and upload one.

 

In the stock avatar URL: 
3delicious/avatar-collection/KPN_Guests/avatar-display-size/message

In the custom URL:
t5/image/serverpage/image-id/382i6D56CCA421653E26/image-dimensions/64x36?v=mpbl-1

The avatar URL of standard avatar sets contain the "avatar-collection" , but the avatar URL of customer upload one does not have. 

 

I am thinking to use FreeMarker string compare class to check "avatar-collection". Is there other better way to do ? thank you

 

Cheers,
Qing

2 Replies

  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)
    11 years ago

    Including the response that was sent separately for everyone else's benefit

     

    We do not offer an OOB API to tell you whether a customer has a “stock” (i.e. from a collection) avatar or a custom uploaded one. Maybe what you could do is to look at all the avatar filenames that are set up in the Asset Library, and write a macro that compares the user avatar link to see if it contains one of these or not. This is an heuristic approach really but it could to the trick. 

     

    Cheers,

     

  • Hi qinglau

     

    I think URL comparision should work because if the avatar is selected from a collection (i.e. Out of box or custom collection), then the URL will always have a avatar-collection keyword.

     

    So I believe this can be used as an valid condition.

     

    Thanks,

    Sunny