By Matthew Pate on Friday, 18 May 2018
Posted in Technical Issues
Likes 0
Views 603
Votes 0
Hi there,

I am trying to integrate easysocial avatars with a third party app. I currently use Amazon s3 storage via easysocial to serve all avatars.

However I need to check if the avatar exists in the s3 bucket before returning the URL otherwise I need to return a default blank avatar or ideally the "letter" avatar (nice colored avatar with initials used by easysocial).

To do this I need to interface with the Amazon s3 API. I was about to download the latest Amazon API but I was thinking that easysocial must have this API baked in and maybe you access it via a class or object within easysocial?

Can I use the same method to simply check if an avatar exists before deciding what to serve?

Any help or direction would be appreciated.

Kind Regards
Matthew
I have a little bit lost here, do you mean you would like to check if the user avatar image whether already push to Amazon S3?

If yes, by default, Easysocial already included this checking from the code, if this user avatar image doesn't push to Amazon S3 yet, it will render the internal server path.

Actually we check for this table `#__social_avatars` , 'storage' columns value if the value stored it as 'Joomla' mean this user avatar image haven't push to Amazon S3.

Perhaps you can take a look at this file JoomlaFolder/administrator/components/com_easysocial/includes/user/user.php, under getAvatar function.

If I misunderstand your current question, perhaps you can elaborate more details regarding this?
·
Friday, 18 May 2018 18:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Great, thank you that helped, I have managed to extend the class based on the file you have referenced.

I can now check if the user:

a) Has an avatar
b) serve a text based avatar
c) or deliver from Amazon
d) if all else fails use a static default avatar

Which is exactly what I want to do.

Most intergrations for easysocial especially for avatars fail when you are serving from Amazon s3.
·
Friday, 18 May 2018 20:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Matthew,

Not too sure if I understand you here but do you mean the avatars isn't working on EasySocial if it is configured to integrate with Amazon S3? Or are you referring to a 3rd party app?
·
Saturday, 19 May 2018 00:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Mark,

No everything is fine with EasySocial, avatars work just fine . EasySocial continues to amaze me and now handles roughly 500 users online at the same time with a member base of of 100,000 on my website, so keep up the good work!

I am building a custom chat script for my site and in doing so was looking for a way to build an efficient function to pull in avatars. Since we serve from amazon s3 I needed to check my bucket to see if a file existed based on the users avatar file name. I know how to get the users file name, users id and so on but I needed to use an api to check the bucket. Instead of installing the api from Amazon , I was wondering if I could hook into easysocials.

Anyway I made it much simpler in the end and now just check the http headers before deciding to serve the avatar from amazon or displaying a default avatar
·
Saturday, 19 May 2018 04:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Ah I see, thanks for the compliments and heads up on this! Glad that your issue is resolved now

By the way, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding
·
Saturday, 19 May 2018 12:40
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post