Advertisement:

Author Topic: Big Performance Tip: Specify a Custom Avatar Directory  (Read 118656 times)

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Big Performance Tip: Specify a Custom Avatar Directory
« Reply #120 on: June 17, 2013, 12:26:14 PM »
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...


Offline 青山 素子

  • Server Team
  • SMF Super Hero
  • *
  • Posts: 17,072
  • 戦場ヶ原、蕩れ!
    • srvrguy on GitHub
    • @motokochan on Twitter
    • Nekomusume Moe
Re: Big Performance Tip: Specify a Custom Avatar Directory
« Reply #121 on: June 17, 2013, 04:09:44 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.


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.


Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Big Performance Tip: Specify a Custom Avatar Directory
« Reply #122 on: June 19, 2013, 03:13:59 AM »
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...
« Last Edit: June 19, 2013, 04:16:57 AM by Gryzor »

Offline Gryzor

  • Sr. Member
  • ****
  • Posts: 783
  • Gender: Male
  • CPCwiki.eu - The Amstrad CPC Encyclopaedia!
    • CPCWiki
Re: Big Performance Tip: Specify a Custom Avatar Directory
« Reply #123 on: June 19, 2013, 04:26:38 AM »
Ah, I think I found something... are the new avatars by user id_member, attachment_type=1 and "filename"?

Offline hebron

  • Semi-Newbie
  • *
  • Posts: 31
  • Gender: Male
    • thomasjsn on GitHub
    • @thomas_jsn on Twitter
    • Fascinating Stuff
Re: Big Performance Tip: Specify a Custom Avatar Directory
« Reply #124 on: July 30, 2014, 10:12:14 AM »
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:

Code: [Select]
;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