• Welcome to Simple Machines Community Forum. Please login or sign up.
November 27, 2021, 10:46:34 PM

News:

SMF 2.0.18 has been released! Please update. Read more.


Big Performance Tip: Specify a Custom Avatar Directory

Started by Something like that, September 30, 2007, 10:19:16 PM

Previous topic - Next topic

Gryzor

I wonder if anyone still watches this thread...

I was wondering, what is the relation between the 'default' avatar parsing address (using index.php) and the direct url setting?

I have the following interesting problem:

I installed a plugin (a chat module) that is trying to fetch the avatars. It tries to use the traditional method, and it fails. So I wanted to change its code, but have no idea how to look for the avatars, since there seems to be no direct correlation between the old and new methods. For instance, for the same user's avatar, the mod is trying to fetch index.php?action=dlattach;attach=8530;type=avatar , while the user's avatar as seen by the forum is at /avs/avatar_93_1365507027.png .

Any help would be greatly appreciated...


青山 素子

Quote from: Gryzor on June 17, 2013, 12:26:14 PM
I was wondering, what is the relation between the 'default' avatar parsing address (using index.php) and the direct url setting?

Going through index.php allows certain things to be done easily, like enforcing image size and also doing basic security checking to help IE, mostly. Going directly is useful in that it lowers the processing that needs to be done (no PHP involved) and also just makes the file loading a simple disk read, which can often be cached in memory by the web server itself.


Quote from: Gryzor on June 17, 2013, 12:26:14 PM
So I wanted to change its code, but have no idea how to look for the avatars, since there seems to be no direct correlation between the old and new methods. For instance, for the same user's avatar, the mod is trying to fetch index.php?action=dlattach;attach=8530;type=avatar , while the user's avatar as seen by the forum is at /avs/avatar_93_1365507027.png .

It's using the filename as it was when the user uploaded it. SMF treats avatar uploads like attachments in that it preserves the original filename. If you want to get the actual filename, you'll need to do some database queries.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Gryzor

June 19, 2013, 03:13:59 AM #122 Last Edit: June 19, 2013, 04:16:57 AM by Gryzor
Oops, I missed your reply, thanks so much.

Yes, I do understand the advantages of direct avatars. Would there be any possibility in helping me with the db - where and what to look for and convert the default avatar path to the 'custom' one? I mean, in the members db table, the avatars column is mostly empty - only avatars residing on external servers (and a few based on avatar sets) are populated...

Thanks again...

Gryzor

Ah, I think I found something... are the new avatars by user id_member, attachment_type=1 and "filename"?

hebron

Sorry to resurrect an old thread like this, but I feel this piece of information is important to some users:

If you are running suPhp you may need to change the following parameter in /etc/suphp/suphp.conf:


;Umask to set, specify in octal notation
;umask=0077
umask=0022


Umask 0077 will cause your avatars to be created with permissions 600, meaning that they will not be accessible on your web-server. By changing this to 0022 they will instead be created with permissions 644 meaning that everyone will have read access.

Permission levels:
600 = Owner: rw
644 = Owner: rw, group: r, everyone: r

FishingManMatt

Hi!

I've just moved my avatars. Better late than never! :-)
Seems everything went fine. Over 700 avatars have been moved to the newly-created directory.
Although there are still 39 files with the "avatar_" prefix and the ".png.tmp" extension left in the attachments dir. And they are all very large files (4-25 MB!).
Do you think they can be removed?

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro


Advertisement: