Retrieve any users avatar

Started by CyanGaming, August 06, 2018, 05:30:19 PM

Previous topic - Next topic

CyanGaming

using php, how can I do an each function which searches a group of elements, finds each username link, grab the id, then use a id to retrieve their avatar from the database and then display that avatar on the page?

I don't really know anything about php sorry :(

Arantor

You don't. There is no way to do this without causing massive load problems on your server.

You want to display avatars with people, load the avatars at the same time as loading the people you're going to be displaying and do it there.

CyanGaming

I ask, because I'd assume it'd make more sense if when you upload an avatar to the server, it saves it under your username, then deletes the old one and replaces it with the new one when you upload a new avatar, why doesn't smf do this?

Arantor

Because it isn't saved under your name. It's saved to one of several places depending on configuration, and requires going to the database to get the file name if nothing else.

This is done for a lot of reasons but the simplest is that the filename includes a timestamp so when you upload a new avatar, browsers don't keep copies of the old one because the file name has a new time on it.



SychO

Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze


CyanGaming


Wellwisher

Rule 101: Never install a new mod without testing first and always keep back-ups of everything before you make any code modifications.

I would generally install a copy of my current forum on my local machine to test out new mods before installing it on the live site. I do this for SMF forum updates is well.   

That mod is pretty good and works on most custom themes. You may be able to get it to working on your site with additional support from the mod author. I would thinker around within a copy of the forum first.

Advertisement: