Simple Machines Community Forum

SMF Support => Server Performance and Configuration => Topic started by: Something like that on September 30, 2007, 10:19:16 PM

Title: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on September 30, 2007, 10:19:16 PM
I just killed about 75% of my php hits by doing this.

Why? If you don't have a specified directory, SMF treats all avatars as attachments, and that means for every avatar displayed, the browser hits index.php to download the image (or at least check if has changed). The following command instructions assume you're in the base directory of the forum software.

First off, create a new directory that's publicly accessible. I chose "avs" as "avatars" was already taken (for the avatars included with SMF). You'll want to make sure it has the same permissions as the attachments directory (enough permission that the user the webserver and/or php run as can modify the contents).

Second, go to the Admin section, and under Avatar Settings, specify the Upload Directory and URL. You can use the settings under Server-stored avatars as a guide (just change avatars to avs).

Now all newly uploaded avatars will use the new directory. But what about all the old uploaded avatars that are still causing hits to php? We can take care of that by running a hidden URL in SMF. The hidden URL is different for SMF 1.1 and SMF 2.0.

Now each request for an avatar will go directly to the image file, bypassing php. This will allow a user to use the avatar image on other sites (by copying the image URL), but it's a small price to pay for massively reduced php hits.

Done!




Alternatively, you can move the avatars manually:

First, copy the avatars from the attachments directory to the avs directory. Conveniently, all the attachment avatars follow the pattern "avatar_*" so a simple "cp -p attachments/avatars_* avs" should suffice.

Second, run this SQL query to inform SMF that users' avatars are in the new directory (we copied them above). Please note that if you used a different prefix for your tables than "smf_" you'll need to adjust the query.
UPDATE `smf_attachments` SET `attachmentType` = '1' WHERE `smf_attachments`.`ID_MEMBER` != 0

Lastly, it's time to clean up the old avatars. Running "rm attachments/avatar_*" should take care of that.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Ben_S on October 01, 2007, 04:43:37 AM
There is an easier way to do this using a built in hidden feature, I posted similar a while back in a hidden board so will just post it all here again.

If you allow users to upload their own avatars, move them to a specific directory rather than have them handled through the attachments system. This way you will save a big chunk of resources since they are served in a "normal way" rather than through index.php

You can do this through Admin > Attachments and Avatars > Avatar Settings > Upload avatars to > Specific directory.

Naturally create the directory and make it writable.

To move existing avatars to the new directory, access index.php?action=manageattachments;sa=moveAvatars

Be warned though your page views stats will drop to the floor, for some reason webalizer and awstats wrongly think an avatar loaded on a page is a page itself rather than a hit.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on October 01, 2007, 05:26:49 AM
Quote from: Ben_S on October 01, 2007, 04:43:37 AM
There is an easier way to do this using a built in hidden feature, I posted similar a while back in a hidden board so will just post it all here again.

If you allow users to upload their own avatars, move them to a specific directory rather than have them handled through the attachments system. This way you will save a big chunk of resources since they are served in a "normal way" rather than through index.php

You can do this through Admin > Attachments and Avatars > Avatar Settings > Upload avatars to > Specific directory.

Naturally create the directory and make it writable.

To move existing avatars to the new directory, access index.php?action=manageattachments;sa=moveAvatars

Be warned though your page views stats will drop to the floor, for some reason webalizer and awstats wrongly think an avatar loaded on a page is a page itself rather than a hit.


Guess I should have spent more time reading the source! lol

Will this change also affect Alexa rankings?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Ben_S on October 01, 2007, 05:38:18 AM
Not got the foggiest to be honest, have never batted an eyelid at Alexa as it's pointless IMO, it shouldn't do though since the toolbar should accurately work out what is a page and what isn't
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on October 04, 2007, 10:05:11 PM
Quote from: dannbass on October 04, 2007, 04:18:37 PM
I'm not able to move the old avatars... ::) with the hidden function.  Any other ways to do it?

Do it like I suggested in the first post :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Ben_S on October 05, 2007, 07:21:22 PM
There is no visual confirmation, it just does it. To check just right click on the image and goto properties and see where it's located, as long as it's not index.php?somewhere then it's done.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: trigi on January 02, 2008, 02:26:32 PM
Done this, still 2 much load on the server.
Got any more ideas how to make things faster?

Do you maybe know if the 1.1.4 works faster than 1.1.1?
And another question, on wich version does SMF work best? PHP4, PHP5 or PHP5+FCGI ?

Bye, Crt
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on January 02, 2008, 09:52:56 PM
Quote from: trigi on January 02, 2008, 02:26:32 PM
Done this, still 2 much load on the server.
Got any more ideas how to make things faster?

Do you maybe know if the 1.1.4 works faster than 1.1.1?
And another question, on wich version does SMF work best? PHP4, PHP5 or PHP5+FCGI ?

Bye, Crt

PHP5+FCGI, especially if you compile APC into PHP.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Owdy on January 08, 2008, 05:14:16 PM
Quote from: Ben_S on October 01, 2007, 04:43:37 AM
There is an easier way to do this using a built in hidden feature,
Why that feature is still hidden? :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: dukeofgaming on January 11, 2008, 11:03:45 PM
More important... what and where are all of the hidden features =P
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Miyagi on January 12, 2008, 11:31:13 PM
thanks for the tip, have implemented. :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: edi67 on January 14, 2008, 12:35:22 PM
Quote from: Ben_S on October 01, 2007, 04:43:37 AM
There is an easier way to do this using a built in hidden feature, I posted similar a while back in a hidden board so will just post it all here again.

If you allow users to upload their own avatars, move them to a specific directory rather than have them handled through the attachments system. This way you will save a big chunk of resources since they are served in a "normal way" rather than through index.php

You can do this through Admin > Attachments and Avatars > Avatar Settings > Upload avatars to > Specific directory.

Naturally create the directory and make it writable.

To move existing avatars to the new directory, access index.php?action=manageattachments;sa=moveAvatars

Be warned though your page views stats will drop to the floor, for some reason webalizer and awstats wrongly think an avatar loaded on a page is a page itself rather than a hit.


Sorry Ben but is possible this ?
i only CREATED the directory for the avatars uploaded by users and AUTOMATICALY all avatars uploaded in paste are GOES in that specific directory without i made not action.

Is possible this ? but is real :) so i ony create AVS directory and everything was done
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on January 14, 2008, 03:54:20 PM
Quote from: Ben_S on October 01, 2007, 04:43:37 AM
Be warned though your page views stats will drop to the floor, for some reason webalizer and awstats wrongly think an avatar loaded on a page is a page itself rather than a hit.

That's because without a custom directory, avatars are sent as output from index.php (which most would assume spits out pages, not images).
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: kamu8recon on March 03, 2008, 04:53:36 AM
Ok i get up to this point and then i get lost, where do I go to run the SQL query? Do i have to go into phpmyadmin to do this? With index.php? are you referring to index.php~ ? and if so where do I insert that code if not where have i gone wrong.

QuoteFourth, run this SQL query to inform SMF that users' avatars are in the new directory (we copied them above). Please note that if you used a different prefix for your tables than "smf_" you'll need to adjust the query.

Code:
UPDATE `smf_attachments` SET `attachmentType` = '1' WHERE `smf_attachments`.`ID_MEMBER` != 0

Thanks for the help,
Kamu
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Owdy on March 04, 2008, 09:43:25 PM
Quote from: Ben_S on October 01, 2007, 04:43:37 AM

You can do this through Admin > Attachments and Avatars > Avatar Settings > Upload avatars to > Specific directory.

Naturally create the directory and make it writable.

To move existing avatars to the new directory, access index.php?action=manageattachments;sa=moveAvatars
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: kamu8recon on March 05, 2008, 01:12:19 AM
I have created the new directory and it is writeable, when you say access index.php? what is the question mark are you referring to ~ .and do I put everything after the questionmark  in the index.php? file, if so then where.

I'm sorry but I am completely lost on this, I have read all the previous posts and I still do not see where to go, any detailed help is much appreciated.

Kamu
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: 青山 素子 on March 06, 2008, 11:00:43 AM
Browse to that URL on your site.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: kamu8recon on March 06, 2008, 11:07:25 AM
Motoko-Chan,

I am not sure what you are referring to so I just put my url here:

http://www.asskikrzrevivl.com/forum/
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: 青山 素子 on March 06, 2008, 11:14:52 AM
Put "index.php?action=manageattachments;sa=moveAvatars" at the end of that in your browser.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: kamu8recon on March 06, 2008, 03:15:19 PM
I have entered that text after my url, it lead me here:

index.php?action=manageattachments;sa=maintenance

I went ahead and clicked maintain and now it doesnt show my avatars that I had before the directory change. It only shows the ones after the change.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: aED on March 28, 2009, 03:09:34 AM
Is this applicable to SMF RC1?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: 青山 素子 on March 28, 2009, 07:47:58 PM
2.0 RC1?

It should be.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: akguide on April 19, 2009, 03:23:47 PM
I created the folder on my server as avs  gave it the same permissions as the attachments folder, however I get An Error Has Occurred!
The attachments upload directory is not writable. Your attachment or avatar cannot be saved.
when trying to upload an image from profile

oh and if I get that figured out how do I run the script to have database look for the images in the new location?

Thanks in advance.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: TigPT on May 28, 2009, 01:34:28 PM
I have just lost my avatars on my server after run the sql query, and when i do this code:


index.php?action=manageattachments;sa=moveAvatars

i get the error:
O directório de upload dos anexos não é de escrita. O seu anexo ou avatar não pode ser gravado.
(can't write, don't have premissions)
Even with the avs path with same acess as atachments one.

Can someone help me? Thanks.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on September 12, 2009, 10:42:06 AM
Quote from: TigPT on May 28, 2009, 01:34:28 PM
I have just lost my avatars on my server after run the sql query, and when i do this code:


index.php?action=manageattachments;sa=moveAvatars

i get the error:
O directório de upload dos anexos não é de escrita. O seu anexo ou avatar não pode ser gravado.
(can't write, don't have premissions)
Even with the avs path with same acess as atachments one.

Can someone help me? Thanks.

If the permissions match, chances are you typed in the path to the directory incorrectly.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Romanj on December 15, 2009, 12:56:30 PM
What about security of this way access to avatars?
As I know, when user upload his file on site, and then place and name of this file on server is known, its security vulnerability.
Or there are no reasons to worry about it?


p.s. sorry for my broken english:)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on December 15, 2009, 01:08:47 PM
It's only an issue if the file contains something malicious. SMF has protection against it.

Note this very forum uses this method.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Tanshaydar on December 18, 2009, 03:40:29 PM
There is a problem for me, when I choose Upload Avatars -> "to a specific directory" I can't enter a directory. I'm using 2.0 RC2
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on December 18, 2009, 03:47:50 PM
That's a reported bug in 2.0 RC2, I think.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Tanshaydar on December 18, 2009, 03:57:52 PM
Oh, I see.
Thanks.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on December 18, 2009, 04:43:09 PM
Quote from: Romanj on December 15, 2009, 12:56:30 PM
What about security of this way access to avatars?
As I know, when user upload his file on site, and then place and name of this file on server is known, its security vulnerability.
Or there are no reasons to worry about it?


p.s. sorry for my broken english:)

It's just an image.

There is a small potential for a security vulnerability, if you have other vulnerable software running on the same machine, but not with SMF.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 19, 2009, 03:36:43 AM
hi All

Nice tip.  But i have one doubt.  After i create a separate directory in root folder what should be its permission set ? 777 or 775 or any other ?

Please guide me.  Thanks in advance.

Note :  I am on shared hosting and don't want any security issues after this change.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Owdy on December 19, 2009, 05:00:49 AM
777 is fine
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 19, 2009, 05:02:03 AM
Quote from: Rudolph the Rednosed on December 19, 2009, 05:00:49 AM
777 is fine

then what about security ? Any compromise on that ?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Owdy on December 19, 2009, 05:09:54 AM
Quote from: talktoanil on December 19, 2009, 05:02:03 AM
Quote from: Rudolph the Rednosed on December 19, 2009, 05:00:49 AM
777 is fine

then what about security ? Any compromise on that ?

Why chmod 777 is NOT a security risk (http://www.simplemachines.org/community/index.php?topic=2987.0)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on December 19, 2009, 05:19:52 AM
777 is only a security risk if you are on a shared server. Anything where you're the only user generally isn't.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 19, 2009, 05:26:00 AM
Quote from: The Grinch on December 19, 2009, 05:19:52 AM
777 is only a security risk if you are on a shared server. Anything where you're the only user generally isn't.

thanks. Yes i am on a shared host. And have already moved the location of folder where avatars are stored.  now please tell me what to do ? what permission should i set to that folder ?

also see if you can help me here
http://www.simplemachines.org/community/index.php?topic=354763.0
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on December 19, 2009, 05:50:12 AM
On a shared host, 775 or better 755.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 19, 2009, 05:55:09 AM
ok i will set it to 755 for my new avatar directory.

also my Public_html folder is set to 777.

what should i set it to ? 
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on December 19, 2009, 06:03:55 AM
755 generally, however note that it may have consequences for you for updates as so on depending on how the host set it up.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: atokar on December 19, 2009, 06:19:06 AM
Note that if you're on a shared host that uses fakefs (fake file system) for your home directory, then you can even put 777 -R on your whole home directory and no one else other than root will be able to access it. Hosts such as Bluehost use this.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 19, 2009, 08:47:29 AM
thanks all for help
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on December 21, 2009, 04:48:23 PM
Quote from: The Grinch on December 19, 2009, 06:03:55 AM
755 generally, however note that it may have consequences for you for updates as so on depending on how the host set it up.

Indeed. SMF requires write privileges to a few directory as the user PHP runs as. Most share hosts will run PHP scripts as a different user than the user's account; SMF requires 777 in those cases.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 22, 2009, 11:49:33 AM
hi all

I have applied this and it was working fine till last night.

1. All my members are of group REGULAR MEMBERS.
2. I am the only Admin,


now issue is ,  11 members only have been able to upload their avtars.

I tried using a frnds account who belongs to REGULAR MEMBER group.

I have made a directory in /public_html/avt where in AVT directory avatars will be stored. but i don't find any reason why users avats are not uploaded in this location.


note : Attachments and Avatars settings page, in Uploadable avatars section,
i have selected Membergroups allowed to upload an avatar to the : "Regular members"
Upload avatars to.. : specific directory
Upload directory: : /home/myforum/public_html/avt
Upload URL ::  http://XXXXX.com/avt


Also in error log of SMF i was not able to find anything..it was blank.

i can deleted and upload my avatar. but many of my regular members are not able to do so.  They dont get any error how ever image is not seen. hence i checked the avt directory but was not able to find the image named avatar_userid   Eg.  avatar_1.jpg
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on December 22, 2009, 01:41:02 PM
Make sure /home/myforum/public_html/avt has 777 permissions. Apache/PHP needs to be able to write to it.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: NoobDeveloper on December 22, 2009, 11:27:56 PM
Quote from: Kris Kringle on December 22, 2009, 01:41:02 PM
Make sure /home/myforum/public_html/avt has 777 permissions. Apache/PHP needs to be able to write to it.

its is dear...and still not able to upload the avatar.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: MazdaClubTR on January 07, 2010, 04:48:19 PM
It was so simple ;

I have created a folder and given the write permission

I have given the folder name as ;

Upload directory:  /var/www/vhosts/<directoryname>

and

Upload URL : http://www.mazdaclubtr.com/ (http://www.mazdaclubtr.com/)<directoryname>

Saved

And runned ;

index.php?action=manageattachments;sa=moveAvatars

It was finished in a few seconds and now all avatars are displayed as images rather than attachments.

Thx for the hint :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on January 11, 2010, 09:38:37 AM
Having modified the system for the bug (2.0RC-2) SEE HERE (http://www.simplemachines.org/community/index.php?topic=358871.msg2445885#msg2445885) I have created the folders as suggested.

I then ran.

index.php?action=manageattachments;sa=moveAvatars

But no avatars have been moved. I've checked via FTP and currently uploaded avatars still show as attachments. There is nothing in the maintenance queue or log to indicate that anything has happened.

I have uploaded a new avatar for a test user and this has been stored in the new folder and shows as an image, so some part of the process is working.

I'm guessing that the hidden command does not work in SMF 2.0 RC-2.

I will try the SQL query when I get home later.
HTH.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 11, 2010, 09:42:04 AM
The URL is different in 2.0 - index.php?action=admin;area=manageattachments;sa=moveAvatars I believe.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on January 11, 2010, 03:27:34 PM
Quote from: Arantor on January 11, 2010, 09:42:04 AM
The URL is different in 2.0 - index.php?action=admin;area=manageattachments;sa=moveAvatars I believe.
Yep, that works fine, thanks (yet again!) Arantor.

Chas
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 11, 2010, 04:17:46 PM
Good to know that worked out Chas.

/me wonders if Mark or Vekseid could get the above hint dropped into the relevant tip postings for our 2.0 users.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on January 11, 2010, 04:41:35 PM
Quote from: Arantor on January 11, 2010, 04:17:46 PM
Good to know that worked out Chas.

/me wonders if Mark or Vekseid could get the above hint dropped into the relevant tip postings for our 2.0 users.

In which post? If it's mine, I can edit it...
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 11, 2010, 04:53:46 PM
I can't remember offhand if Vekseid's master post just links here or mentions it as well, but if you could add it here too it would be appreciated.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Something like that on January 11, 2010, 05:03:09 PM
Quote from: Arantor on January 11, 2010, 04:53:46 PM
I can't remember offhand if Vekseid's master post just links here or mentions it as well, but if you could add it here too it would be appreciated.

Done. Let me know if it's still confusing.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 11, 2010, 05:19:24 PM
Marvellous thanks, it doesn't seem confusing at all - just it is now covered for both :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: ModelBoatMayhem on January 12, 2010, 12:06:02 PM
All great stuff here, thanks to everyone.

... how do I check it's made a difference?
     Check Awstats after a day or so?

Martin   :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 12, 2010, 12:20:24 PM
Awstats doesn't AFAIR give you load. Ideally you want to be able to check with your host (or if you're on a VPS type deal or more powerful, top or similar will be able to show you load) - you should see load drop pretty quickly.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on January 17, 2010, 11:48:04 AM
I checked using FTP to inspect the contents of the new folder.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 09:02:43 AM
hi there i'm on smf 2.0 rc2 and i've gone to

QuoteAdministration Center » Attachments and Avatars » Avatar Settings

and on 'Upload avatars to...' i've selected 'specify directory' but i can type anything in the two below boxes?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: curlin on February 08, 2010, 11:56:21 AM
Quote from: ppbz on February 08, 2010, 09:02:43 AM
hi there i'm on smf 2.0 rc2 and i've gone to

QuoteAdministration Center » Attachments and Avatars » Avatar Settings

and on 'Upload avatars to...' i've selected 'specify directory' but i can type anything in the two below boxes?

    I thought i was alone on this as it weirded me out  :o
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on February 08, 2010, 12:53:40 PM
Quote from: curlin on February 08, 2010, 11:56:21 AM
Quote from: ppbz on February 08, 2010, 09:02:43 AM
hi there i'm on smf 2.0 rc2 and i've gone to

QuoteAdministration Center » Attachments and Avatars » Avatar Settings

and on 'Upload avatars to...' i've selected 'specify directory' but i can type anything in the two below boxes?

    I thought i was alone on this as it weirded me out  :o
See this discussion.  (http://www.simplemachines.org/community/index.php?topic=197938.msg2448939#msg2448939) There is a bug in 2.0 relating to this, the link in my post shows the fix to cure it. The instruction to move avatars has changed for 2.0 see the posts following.
HtH
Chas
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 01:14:14 PM
Quote from: Chas Large on February 08, 2010, 12:53:40 PM
Quote from: curlin on February 08, 2010, 11:56:21 AM
Quote from: ppbz on February 08, 2010, 09:02:43 AM
hi there i'm on smf 2.0 rc2 and i've gone to

QuoteAdministration Center » Attachments and Avatars » Avatar Settings

and on 'Upload avatars to...' i've selected 'specify directory' but i can type anything in the two below boxes?

    I thought i was alone on this as it weirded me out  :o
See this discussion.  (http://www.simplemachines.org/community/index.php?topic=197938.msg2448939#msg2448939) There is a bug in 2.0 relating to this, the link in my post shows the fix to cure it. The instruction to move avatars has changed for 2.0 see the posts following.
HtH
Chas

sweet thank you :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 01:31:16 PM
ok folders changed now but when i go to the below address it just takes me to 'Attachments and Avatars » File Maintenance' and no avatars have been moved?

Quotehttp://domain.com/index.php?action=admin;area=manageattachments;sa=maintenance
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on February 08, 2010, 02:07:30 PM
Quote from: ppbz on February 08, 2010, 01:31:16 PM
ok folders changed now but when i go to the below address it just takes me to 'Attachments and Avatars » File Maintenance' and no avatars have been moved?

Quotehttp://domain.com/index.php?action=admin;area=manageattachments;sa=maintenance
You need to run the script to move the avatars from the current location in Attachments to the new folder, see the post under the one I pointed you to earlier.
Your link does not work and just points to a domain registration page. Perhaps the URL is not yet live.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 02:43:57 PM
Quote from: Chas Large on February 08, 2010, 02:07:30 PM
Quote from: ppbz on February 08, 2010, 01:31:16 PM
ok folders changed now but when i go to the below address it just takes me to 'Attachments and Avatars » File Maintenance' and no avatars have been moved?

Quotehttp://domain.com/index.php?action=admin;area=manageattachments;sa=maintenance
You need to run the script to move the avatars from the current location in Attachments to the new folder, see the post under the one I pointed you to earlier.
Your link does not work and just points to a domain registration page. Perhaps the URL is not yet live.

I replace my domain with domain.com lol
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Owdy on February 08, 2010, 04:11:21 PM
Is there way to undo this?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on February 08, 2010, 04:44:43 PM
I don't believe so, no. Not automatically, anyway.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 05:14:15 PM
so can anyone help me please?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on February 08, 2010, 05:35:16 PM
Quote from: ppbz on February 08, 2010, 05:14:15 PM
so can anyone help me please?

So you've set the folders up right?

You know, you could read the first post in this thread again which gives you the proper address you go to, putting your website at the front though.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 05:43:22 PM
Quote from: Arantor on February 08, 2010, 05:35:16 PM
Quote from: ppbz on February 08, 2010, 05:14:15 PM
so can anyone help me please?

So you've set the folders up right?

You know, you could read the first post in this thread again which gives you the proper address you go to, putting your website at the front though.

i've done the folder and i did set the link up right i showed you how i had it before... (changed my domain to domain.com thought)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on February 08, 2010, 05:53:31 PM
So you've used domain.com/index.php?action=admin;area=manageattachments;sa=moveAvatars

Because if you have... you haven't said that. All you've said:

Quote from: ppbz on February 08, 2010, 01:31:16 PM
ok folders changed now but when i go to the below address it just takes me to 'Attachments and Avatars » File Maintenance' and no avatars have been moved?

Quotehttp://domain.com/index.php?action=admin;area=manageattachments;sa=maintenance


Different URL entirely.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 05:58:58 PM
Quote from: Arantor on February 08, 2010, 05:53:31 PM
So you've used domain.com/index.php?action=admin;area=manageattachments;sa=moveAvatars

Because if you have... you haven't said that. All you've said:

Quote from: ppbz on February 08, 2010, 01:31:16 PM
ok folders changed now but when i go to the below address it just takes me to 'Attachments and Avatars » File Maintenance' and no avatars have been moved?

Quotehttp://domain.com/index.php?action=admin;area=manageattachments;sa=maintenance


Different URL entirely.

i've used the index.php?action=admin;area=manageattachments;sa=moveAvatars one but it redirects to index.php?action=admin;area=manageattachments;sa=maintenance
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on February 08, 2010, 06:21:11 PM
It should redirect once it's moved the avatars.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 08, 2010, 06:56:22 PM
Quote from: Arantor on February 08, 2010, 06:21:11 PM
It should redirect once it's moved the avatars.

but it moved nothing :\
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: curlin on February 08, 2010, 09:34:58 PM
Nothing? (http://www.youtube.com/watch?v=34ag4nkSh7Q&feature=related)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: waruna on February 13, 2010, 02:29:43 AM
Quote from: Chas Large on February 08, 2010, 12:53:40 PM
See this discussion.  (http://www.simplemachines.org/community/index.php?topic=197938.msg2448939#msg2448939) There is a bug in 2.0 relating to this, the link in my post shows the fix to cure it. The instruction to move avatars has changed for 2.0 see the posts following.
HtH
Chas

Sorry for being hard to understand. Can I have details instruction on how to specify a custom avatar directory for RC2? I know in RC2 there's a bug in Upload directory text box. But I'm confuse which instruction should I follow to make this thing done. :(

Thanks for helping.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 13, 2010, 02:34:09 AM
is there a manual way to move as the link for rc2 isn't working as it moves nothing :\
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on February 13, 2010, 04:34:53 AM
Quote from: waruna on February 13, 2010, 02:29:43 AM
Quote from: Chas Large on February 08, 2010, 12:53:40 PM
See this discussion.  (http://www.simplemachines.org/community/index.php?topic=197938.msg2448939#msg2448939) There is a bug in 2.0 relating to this, the link in my post shows the fix to cure it. The instruction to move avatars has changed for 2.0 see the posts following.
HtH
Chas

Sorry for being hard to understand. Can I have details instruction on how to specify a custom avatar directory for RC2? I know in RC2 there's a bug in Upload directory text box. But I'm confuse which instruction should I follow to make this thing done. :(

Thanks for helping.
You need to fix the bug in RC2 by changing the two instances of updateStatus to FUpdateStatus in ManageAttachments.php as described in the notes HERE (http://www.simplemachines.org/community/index.php?topic=358871.msg2447322#msg2447322)
You can then enter the Name and URL of the new Avatar directory in the boxes.

Once you have done that you then run the code to move the Avatars from the current attachment directory to the new directory. To do this add the code in the browser address bar like this.

http://yourdomain/yourforum/index.php?action=admin;area=manageattachments;sa=moveAvatars
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: waruna on February 13, 2010, 04:38:38 AM
So that means I have to open Source/ManageAttachmenst.php, and find:

// External avatars?
array('title', 'avatar_external'),
array('permissions', 'profile_remote_avatar', 0, $txt['avatar_external_url_groups']),
array('check', 'avatar_download_external', 0, 'onchange' => 'updateStatus();'),
array('text', 'avatar_max_width_external', 6),
array('text', 'avatar_max_height_external', 6),
array('select', 'avatar_action_too_large',
array(


And replace the whole code above with:

Index: ManageAttachments.php
===================================================================
--- ManageAttachments.php   (revision 9462)
+++ ManageAttachments.php   (revision 9463)
@@ -229,7 +229,7 @@
       // External avatars?
       array('title', 'avatar_external'),
          array('permissions', 'profile_remote_avatar', 0, $txt['avatar_external_url_groups']),
-         array('check', 'avatar_download_external', 0, 'onchange' => 'updateStatus();'),
+         array('check', 'avatar_download_external', 0, 'onchange' => 'fUpdateStatus();'),
          array('text', 'avatar_max_width_external', 6),
          array('text', 'avatar_max_height_external', 6),
          array('select', 'avatar_action_too_large',
@@ -247,7 +247,7 @@
          array('text', 'avatar_max_height_upload', 6),
          array('check', 'avatar_resize_upload', 'subtext' => $txt['avatar_resize_upload_note']),
          array('check', 'avatar_download_png'),
-         array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'updateStatus();'),
+         array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'fUpdateStatus();'),
          array('text', 'custom_avatar_dir', 40, 'subtext' => $txt['custom_avatar_dir_desc'], 'invalid' => !$context['valid_custom_avatar_dir']),
          array('text', 'custom_avatar_url', 40),
    );


Is that right sir? Thanks.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on February 13, 2010, 04:39:04 AM
Quote from: ppbz on February 13, 2010, 02:34:09 AM
is there a manual way to move as the link for rc2 isn't working as it moves nothing :\
Providing you have created the directory (I created mine in FTP and gave it 777 permission). then the code to move the files does work. There is no easy manual way to move them and cross reference them back to the profile. If you have a lot of members with uploaded avatars then ask them to re-upload them and they will be placed in the new directory from now on.

Are you sure you fixed the bug correctly as shown HERE (http://www.simplemachines.org/community/index.php?topic=358871.msg2447322#msg2447322)?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Chas Large on February 13, 2010, 04:41:44 AM
Quote from: waruna on February 13, 2010, 04:38:38 AM
So that means I have to open Source/ManageAttachmenst.php, and find:

// External avatars?
array('title', 'avatar_external'),
array('permissions', 'profile_remote_avatar', 0, $txt['avatar_external_url_groups']),
array('check', 'avatar_download_external', 0, 'onchange' => 'updateStatus();'),
array('text', 'avatar_max_width_external', 6),
array('text', 'avatar_max_height_external', 6),
array('select', 'avatar_action_too_large',
array(


And replace the whole code above with:

Index: ManageAttachments.php
===================================================================
--- ManageAttachments.php   (revision 9462)
+++ ManageAttachments.php   (revision 9463)
@@ -229,7 +229,7 @@
       // External avatars?
       array('title', 'avatar_external'),
          array('permissions', 'profile_remote_avatar', 0, $txt['avatar_external_url_groups']),
-         array('check', 'avatar_download_external', 0, 'onchange' => 'updateStatus();'),
+         array('check', 'avatar_download_external', 0, 'onchange' => 'fUpdateStatus();'),
          array('text', 'avatar_max_width_external', 6),
          array('text', 'avatar_max_height_external', 6),
          array('select', 'avatar_action_too_large',
@@ -247,7 +247,7 @@
          array('text', 'avatar_max_height_upload', 6),
          array('check', 'avatar_resize_upload', 'subtext' => $txt['avatar_resize_upload_note']),
          array('check', 'avatar_download_png'),
-         array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'updateStatus();'),
+         array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'fUpdateStatus();'),
          array('text', 'custom_avatar_dir', 40, 'subtext' => $txt['custom_avatar_dir_desc'], 'invalid' => !$context['valid_custom_avatar_dir']),
          array('text', 'custom_avatar_url', 40),
    );


Is that right sir? Thanks.
NO! DO NOT ADD THAT SECOND CODE BLOCK!
Just find updateStatus in your file change that to FUpdateStatus. There are two instances.
The code in the second block is a history of what was changed between the RC2 version and the Charter version.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 13, 2010, 04:45:24 AM
Quote from: Chas Large on February 13, 2010, 04:39:04 AM
Quote from: ppbz on February 13, 2010, 02:34:09 AM
is there a manual way to move as the link for rc2 isn't working as it moves nothing :\
Providing you have created the directory (I created mine in FTP and gave it 777 permission). then the code to move the files does work. There is no easy manual way to move them and cross reference them back to the profile. If you have a lot of members with uploaded avatars then ask them to re-upload them and they will be placed in the new directory from now on.

Are you sure you fixed the bug correctly as shown HERE (http://www.simplemachines.org/community/index.php?topic=358871.msg2447322#msg2447322)?

yeah i've done that and put in the new folders and people new avatars are getting uploaded but the link won't move the old ones

here's the edit

// External avatars?
array('title', 'avatar_external'),
array('permissions', 'profile_remote_avatar', 0, $txt['avatar_external_url_groups']),
array('check', 'avatar_download_external', 0, 'onchange' => 'fUpdateStatus();'),
array('text', 'avatar_max_width_external', 6),
array('text', 'avatar_max_height_external', 6),
array('select', 'avatar_action_too_large',
array(
'option_refuse' => $txt['option_refuse'],
'option_html_resize' => $txt['option_html_resize'],
'option_js_resize' => $txt['option_js_resize'],
'option_download_and_resize' => $txt['option_download_and_resize'],
),
),
// Uploadable avatars?
array('title', 'avatar_upload'),
array('permissions', 'profile_upload_avatar', 0, $txt['avatar_upload_groups']),
array('text', 'avatar_max_width_upload', 6),
array('text', 'avatar_max_height_upload', 6),
array('check', 'avatar_resize_upload', 'subtext' => $txt['avatar_resize_upload_note']),
array('check', 'avatar_download_png'),
array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'fUpdateStatus();'),
array('text', 'custom_avatar_dir', 40, 'subtext' => $txt['custom_avatar_dir_desc'], 'invalid' => !$context['valid_custom_avatar_dir']),
array('text', 'custom_avatar_url', 40),
);


but going to that link just takes me to the avatars 'File Maintenance' page

this is my link

Quotehttp://domain.com/index.php?action=admin;area=manageattachments;sa=moveAvatars
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 13, 2010, 04:49:21 AM
found the problem... my folder was called attachment and not attachments (problems from smf 1.1.11?)

anyway it's moved some but there's still a few it didn't?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: waruna on February 13, 2010, 05:02:12 AM
Quote from: Chas Large on February 13, 2010, 04:41:44 AM
NO! DO NOT ADD THAT SECOND CODE BLOCK!
Just find updateStatus in your file change that to FUpdateStatus. There are two instances.
The code in the second block is a history of what was changed between the RC2 version and the Charter version.

Yeah sorry. Ok it works now. I can enter the Upload Directory. Thank you sir.

I put,
Upload Directory: public_html/v10/avs
Upload URL : www.mydomain.net/v10/avs/

Then I use FTP client to chmod the avs directory to '777'.
But when I go to "http://www.mydomain.net/v10/index.php?action=admin;area=manageattachments;sa=moveAvatars", an error has occured:
The attachments upload directory is not writable. Your attachment or avatar cannot be saved.

Have I done something wrong there? Thanks
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: waruna on February 13, 2010, 05:06:13 AM
Sorry sir, please ignore my previous post. I just change public/v10/avs to only 'avs', and it works like a charm! Many thanks to you.

So the URL of the avatars should be like this right?:
http://www.mydomain.net/v10/avs//avatar_136_1266052025.jpg

I wonder why there are two slashes?  :-\
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: steve51184 on February 13, 2010, 05:08:21 AM
Quote from: waruna on February 13, 2010, 05:06:13 AM
Sorry sir, please ignore my previous post. I just change public/v10/avs to only 'avs', and it works like a charm! Many thanks to you.

So the URL of the avatars should be like this right?:
http://www.mydomain.net/v10/avs//avatar_136_1266052025.jpg

I wonder why there are two slashes?  :-\

change www.mydomain.net/v10/avs/ to just www.mydomain.net/v10/avs
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: bzgzd on February 14, 2010, 01:41:10 AM
I also encountered this bug but I "solved" it using Firefox with Firebug installed.

It is possible to navigate in html view of firebug to those two <input> elements and delete them disabled="" (of course after saving and refreshing page they are again disabled but already with set values)

-----

Btw those "double slash" in path I found also in SMF... I hope it makes no trouble. Also in this forum on main forum page www.simplemachines.org/community/index.php are few images referenced like:
.../Themes/default/images//on.png
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Buschiq on March 30, 2010, 06:26:06 PM
Using smf 1.1.11

I tried this, followed the first example but nothing happened. The images still had the index.php-adress afterwards.
So, I decided to try the manual version, but after I ran the SQL query the images disappeared and now I can't find them? 
Or more correctly put, we can't access them. No avatars are shown and when I rightclick the "missing image icon" I get this error message:

Forbidden
You don't have permission to access /avatar_1.png on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Is there a way to undo the SQL query, a way to reverse it and how in that case?

The folders: attachments, avatars and avs all have 777 permissions

When uploading a new avatar afterwards it also got the index.php-adress
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Joker™ on April 03, 2010, 06:57:33 AM
awesome trick .... my forum speeds up a bit ... big thanx to everyone :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: jvmedia on May 17, 2010, 11:11:11 PM
Is having your uploaded avatars go to the /attachments folder good or bad?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: carlatf on December 02, 2010, 08:06:13 AM
I did all the above, but some avatars are not displayed, or not in the attachements directory at all.

For example http://tresjolie.com.ar/forum/uploaded/avatar_18929.png

I also searched for avatar_18929.png in the whole server and I couldn't find it
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: carlatf on December 12, 2010, 12:55:31 PM
Hi,
I made the changes but it didn't work out, now my problem is that the system doesnt let me go back to my initial configuration.
It doesnt let me save "attachements" directory again, it keeps selecting "specific directory"
best regards,
Carla
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: bbmtalk on January 12, 2011, 12:04:22 PM
I follow the step outlined in the first post but nothing happened. Avatars were not moved to the new folder.

Running 1.1.11. Any help?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: stog on January 27, 2011, 07:35:42 PM
hi happy new year

i don't want to double post, but i've just found this thread, and run the mysql query in the hope that  my existing forum members avatars would show; although they were moved and appear in the avs folder, but  when one browses the avatar files, the link appears with a double slash and thus won't load.

i am on 1.1.12 with tiny portal and a custom theme and my post earlier today, was made in the twenty four things topics here http://www.simplemachines.org/community/index.php?topic=293441.msg2930501#msg2930501

if anyone can point me in the right direction i would be very grateful as otherwise this admin will soon be catfood   :o:)

thx




several hours on i am wondering whether the double slash is caused by my running the "MoveAvatars" script twice, as what it does ? some 20 lines in,  is add a slash here
if (rename($filename, $modSettings['custom_avatar_dir'] . '/' . $row['filename']))

ref line 430 ManageAttachments.php

and if this is the case how could i correctly remove one of the slashes from the renamed dir path ?

any help appreciated

cheers
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: bloc on February 21, 2011, 06:14:53 AM
Worked very well, and it seems to display slightly faster too. :)
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Masterd on February 21, 2011, 07:16:34 AM
This really speeded up my forum! Thanks, «Mark»! :D
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: toloekka on February 26, 2011, 03:44:29 AM
Hi. :)

We have a big Attachment folder (3 GB) and I will try this "Specify a Custom Avatar Directory" option.

But I have a question, is this reversable if something go wrong?
Can I just make a copy of the database file and a copy of my SMF files to make it reverseable?

toloekka
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: searchgr on April 02, 2011, 02:19:57 AM
Can u update for RC5?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: z_dane on April 10, 2011, 10:31:53 PM
Haha now i understand why i got error "The attachments upload directory is not writable. Your attachment or avatar cannot be saved."

Firstly i just edit the 1st section - Server-stored avatars
Avatars directory :  public_html/v10/avs
Avatars URL : www.mydomain.net/v10/avs

Actually need to update at the last section - Uploadable avatars
and do select

Use PNG for resized avatars
Upload avatars to Specific directory
Upload directory : public_html/v10/avs
Upload URL : www.mydomain.net/v10/avs

and then try "http://www.mydomain.net/v10/index.php?action=admin;area=manageattachments;sa=moveAvatars"

Mine use SMF 2.0RC5.
If want to do manually need to change SQL query a little bit. Actual if auto above already fine then we don't need this manual.
UPDATE `smf_attachments` SET `attachment_type` = '1' WHERE `smf_attachments`.`ID_MEMBER` != 0
For RC5 no need to worry about /ManageAttachmenst.php. The source code problem only for RC2 and not on RC5
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: teos55 on April 28, 2011, 12:41:26 PM
Need help .
Runnning SMF 1.1.13
created a new directory
moved the avatars to new directory.  (not manualy but with "http://www.xxxx.org/index.php?action=admin;area=manageattachments;sa=moveAvatars) 

no error msg. i checked the new directory, avatars are there )

Result, all the existing avatars does not show up in the forum. 
What did i do wrong ?



I digged a little bit.  Tried to browse from admin panel - att&avatars - browse files -  avatars  the file is there. ( i confirmed with ftp client filezilla. it is there. the avatar directory is 700  and the png file is 644 privilages )

  But, when i click the png file in the browse files- avatars - xxx.png,  i got the following error attached

nb. i tried to load my avatar image  from my profile, no err msg but no avatar when i view, in the forum and the profile page

another test :
typing www.xxxx.org/httpdocs/avs/avatar_1.jpg  or any other avatar shows the picture in the browser, so file is there but  smf does not recognize somehow.

  Even I cannot load the sytem default avatars from the avatars directory through profile menu. Nothing happens.

  Pls help, it is urgent
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: searchgr on April 28, 2011, 09:24:49 PM
Did u change the link in Adm = Attachments & avatars - Avatars settings?


PLs let me know if the performance has been improved.


Thanks
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: teos55 on April 29, 2011, 04:02:27 AM
  Left the server settings as it is and changed only uploadable avatars part.  Then executed moveavatars ...
Should I also change the server part to the new directory ?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: teos55 on April 29, 2011, 07:47:52 AM
  Ha ha found the mistake ,
In the "uploadable avatars"  I coded "www.xxx.org/httpdocs/avs"  which should be "www.xxxx.org/avs" .
Found it by coincedance while digging for another issue.
Thanks guiding me to look into settings.
Case closed
Oguz

Quote from: teos55 on April 29, 2011, 04:02:27 AM
  Left the server settings as it is and changed only uploadable avatars part.  Then executed moveavatars ...
Should I also change the server part to the new directory ?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: searchgr on April 29, 2011, 02:55:00 PM
Have you seen any improvement in the performance?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: teos55 on April 29, 2011, 03:38:44 PM
  Unfortunately not. Since I'm running a shared hosting, most of the issues are related to this environment.
Thanks for your follow up
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Martine M on July 10, 2011, 07:00:08 AM
I got the avatars moved and ran sql

UPDATE `smf_attachments` SET `attachment_type` = '1' WHERE `smf_attachments`.`ID_MEMBER` != 0

But avatars of people who uploaded them don't show anymore, table prefix is the same.

I did it all at my test forum so no harm done.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Martine M on July 10, 2011, 07:38:22 AM
it's solved.
I made a mistake filled in twice the directory of the specific avatar, instead of once the url.

I'm going to do this at the live forum now and let you know if things speed up.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: searchgr on July 10, 2011, 11:56:08 AM
thank you
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Martine M on July 10, 2011, 05:48:24 PM
It did speed up, pages load good but It is still slow with posting.
Changed some other settings now, so I hope that will help to.
Or maybe it is the host to although they say everything fine at there end.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: ladiewinter on August 02, 2011, 05:11:17 PM
If anyone is still helping with this thread, I was wondering what I can do about the avatar directory.  Here's the problem: when I select the option to upload it to a specific directory, as is recommended, the page does not allow me to actually enter that specific directory into the box below this.  I've clicked on it, and nothing happens.  I can't type in it, and can't add anything to it in any way.  Does anyone know why this is, and how I can fix it? 

Any help is greatly appreciated.  Thank you in advance. 
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: vistaway on October 03, 2011, 08:30:57 PM
I didn't see it mentioned, but there is a small typo in the first post:

SMF 1.1: index.php?action=manageattachments;sa=moveAvatar

Should be:

SMF 1.1: index.php?action=manageattachments;sa=moveAvatars

Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Feldunost on March 08, 2012, 07:17:18 AM
Hello,


Why we don't delete directly index.php file ?

Something is related ?


Thanks
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: IgorS on January 09, 2013, 08:45:51 AM
Hi.

I'm sorry that I unearthed this old topic, but I've got one question.

Can I do the same with attachments folder? My forum is something like photo-gallery and users upload photos to forum server. For each message there is at least one image (up to three).
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 09, 2013, 09:11:26 AM
No, you can't. The avatars folder can be safely extracted like this, but the attachments folder cannot, for security reasons and privacy reasons.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: IgorS on January 09, 2013, 10:29:49 AM
So it's unpossible to bypassing PHP in attachments (like in avatars) or it's "just" unsafe?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on January 09, 2013, 10:32:27 AM
If you consider having your server taken over as 'just' unsafe, I'd hate to consider what you consider actually unsafe.

Let me explain. Prior to SMF 1.1.9 / 2.0 RC1-1, it was possible to hack an SMF installation through the attachments system. It was possible to the point where entire servers were taken over. All because of this 'bypassing'. Which is why 1.1.9 / 2.0 RC1-1 disabled that little 'helpful' facility.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: rancid4all on February 06, 2013, 04:23:25 AM
hello
i have followed the instructions from page 1 and everythings working fine *thank you*
but i have another problem:
i have installed cometchat on my forum before this
now the cometchat getavatar function on integration failed to show avatar because the function gets the default address for avatar
it goes like this

function getAvatar($image) {

$avatar = explode('^',$image);
$avatar_name = $avatar[0];
$avatar_id = $avatar[1];

if($avatar_name == "")
{
if($avatar_id == "")
{
return BASE_URL.'../avatars/blank.gif';
}
else
{
return BASE_URL.'../index.php?action=dlattach;attach=' . $avatar_id . ';type=avatar';
}
}
elseif(strpos($avatar_name,'http',0) >= -1)
{
return $avatar_name;
}
else
{
return BASE_URL.'../avatars/' . $avatar_name;
}

}


so whats need to be changed?
would you guys kindly help me
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: kevin.michiels on March 17, 2013, 08:34:48 PM
Hi
I had some big problems lately with this so I decided to return things to what they where before.
The attachment directory.

Now when users upload avatars they are put in the original attachment folder = GOOD;
The only thing I cant mange to do is the current ones. Old Members profile pictures are still directing to the old non existing directory.
I want to move the old avatars back to the attachment folder.
How can this be achieved ? Cause the index.php?action=manageattachments;sa=moveAvatars is not working.

Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Arantor on March 22, 2013, 12:39:55 AM
Are you using SMF 2.0 or 1.1? If you're using 2.0, you need to re-read the instructions, as it says the URL is different.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: kevin.michiels on March 25, 2013, 06:07:56 AM
I also tried index.php?action=admin;area=manageattachments;sa=moveAvatars and it changes moveAvatars at the end into maintenance.
Then redirects to "attachments and avatars" > "File maintenance ".
Avatars are not moved yet.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Gryzor 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...

Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: 青山 素子 on June 17, 2013, 04:09:44 PM
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.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Gryzor 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...
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: Gryzor 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"?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: hebron 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:


;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
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: FishingManMatt on November 21, 2019, 03:47:32 PM
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?
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: vbgamer45 on November 21, 2019, 06:24:09 PM
Yes, safe to remove .tmp files.
Title: Re: Big Performance Tip: Specify a Custom Avatar Directory
Post by: FishingManMatt on November 22, 2019, 07:21:17 AM
Many thanks!