News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Big Performance Tip: Specify a Custom Avatar Directory

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

Previous topic - Next topic

Chas Large

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.
My Modifications :)  My Forum

Please DO NOT PM me with support requests. Post the problem in the appropriate Support Board so everyone can benefit from the advice given.

steve51184

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?

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

steve51184

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?

waruna

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
Trust of Lust

waruna

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?  :-\
Trust of Lust

steve51184

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

bzgzd

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

Buschiq

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

Joker™

awesome trick .... my forum speeds up a bit ... big thanx to everyone :)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

jvmedia

Is having your uploaded avatars go to the /attachments folder good or bad?

carlatf

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

carlatf

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

bbmtalk

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?

stog

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

bloc

Worked very well, and it seems to display slightly faster too. :)

Masterd


toloekka

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

searchgr


z_dane

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 [nofollow]

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 [nofollow]

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

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

teos55

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

Advertisement: