Author |
Message |
Raven
Site Admin/Owner
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Thu Sep 18, 2003 11:12 pm |
|
After playing with this all night and figuring out the patterns, I believe the following will fix all avatar broken images and pathing issues. The main problems stems from the way the forums store the avatar paths and nuke stores, or doesn't store them. I believe that this fixes all scenarios.
First of all BACKUP your users table and your Your_Account/index.php file!!!!
Then, in Forum Configuration, set the 2 avatar settings to
modules/Forums/images/avatars
Then, modify modules/Your_Account/index.php as follows.
Find and change all instances of
/gallery/$userinfo
to
/$userinfo
Then on or about line 771 comment out this line
$userinfo[user_avatar] = ereg_replace("gallery/","",$userinfo[user_avatar]);
so it should look like this
//$userinfo[user_avatar] = ereg_replace("gallery/","",$userinfo[user_avatar]);
Then on or about linee 998 and also 1010, find this code
user_avatar='$user_avatar'
and change it to
user_avatar='gallery/$user_avatar'
If this breaks some user's avatars, then it's probably because the avatar had been saved w/o the gallery prefix in the path. Or some other work-around had been attempted. There could be many scenarios based on each site. If you run into that problem, contact me back here and I will try to help you.
Note that I tested this on 6.8 an 6.9. It should work on 6.5 also, but 'buyer beware' |
|
|
|
|
blith
Client
Joined: Jul 18, 2003
Posts: 977
|
Posted:
Fri Sep 19, 2003 7:36 am |
|
Raven, after applying your fix. I had a broken avatar still with this path.
Code:http://www.gamersroam.com/modules/Forums/images/avatars/079.gif
|
The ones that work look like this.
Code:http://www.gamersroam.com/modules/Forums/images/avatars/gallery/107.gif
|
How can I add the gallery to the paths of those who do not have it? Thanks. |
|
|
|
|
Raven
|
Posted:
Fri Sep 19, 2003 7:44 am |
|
First test that that is the problem by manually updating that users record in the users_table using phpMyAdmin. Correct the user_avatar to gallery/079.gif.
If that works, then you could try running this query
UPDATE nuke_users
set user_avatar = 'gallery/'||user_avatar
where user_avatar not like 'gallery%';
Be sure to back up your users table before attempting this. I have not tested the SQL but it should work. |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:17 am |
|
right, will do. I did a backup of the tables before applying the fix. Thanks. |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:28 am |
|
Well I edited the one record and it shows up properly so I ran the query and it said it affected 408 rows so... I hope we have it... |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:31 am |
|
After checking the forums all the offsite avatars have been killed they all have red xs now.... any suggestions? The records that had offsite links to avatars all have 0 in the user_avatar field |
Last edited by blith on Fri Sep 19, 2003 9:31 am; edited 1 time in total |
|
|
|
Raven
|
Posted:
Fri Sep 19, 2003 9:31 am |
|
The only unknown is uploaded avatars. Those are encoded and they may end up with a broken image with a gallery/gallery/ path. Hope not. |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:33 am |
|
we posted at the same time.... I think my post reflects your worry |
|
|
|
|
Raven
|
Posted:
Fri Sep 19, 2003 9:34 am |
|
You may just have to have the people reload them. Remeber that we are trying to remediate an error in the original coding, not work around it. Since the path is encoded in the md5'd name, there is no way to modify that programatically. |
|
|
|
|
Raven
|
Posted:
Fri Sep 19, 2003 9:39 am |
|
As a test, remove the gallery/ from in front of one of the uploaded avatars and see if it functions correctly. If so, I may be able to write another SQL query. |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:40 am |
|
yes.. I redid my avie and it shows up fine now... thank you. I will have everyone redo theirs... |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:41 am |
|
Raven wrote: | As a test, remove the gallery/ from in front of one of the uploaded avatars and see if it functions correctly. If so, I may be able to write another SQL query. |
There was no longer a path it just showed up as a zero (0) |
|
|
|
|
Raven
|
Posted:
Fri Sep 19, 2003 9:41 am |
|
That's really the correct and best way. |
|
|
|
|
blith
|
Posted:
Fri Sep 19, 2003 9:47 am |
|
Just in case you didn't see it becasue we posted at the ame time again...
Raven wrote:
As a test, remove the gallery/ from in front of one of the uploaded avatars and see if it functions correctly. If so, I may be able to write another SQL query.
Blith wrote:
There was no longer a path it just showed up as a zero (0) |
|
|
|
|
freeby
New Member
Joined: Aug 25, 2003
Posts: 20
Location: UK
|
Posted:
Fri Sep 19, 2003 1:02 pm |
|
Just applied the fix on my 6.5 and it works great, thanks once more |
|
|
|
|
Raven
|
Posted:
Tue Sep 23, 2003 7:52 pm |
|
The only thing I still haven't fixed is the broken avatar on new users to the forum. Got a fix for that |
|
|
|
|
sqzdog
Involved
Joined: Sep 22, 2003
Posts: 252
|
Posted:
Tue Sep 23, 2003 7:58 pm |
|
I can't get any avatars to display in the forums or Ravens site info block. Is this what fixes that avatars on the site info block? See the site info block on my site so you can see what I am talking about Only registered users can see links on this board! Get registered or login! |
|
|
|
|
Raven
|
Posted:
Tue Sep 23, 2003 8:05 pm |
|
It may. Try it and see. Back up your files as I prescribe and you may have to resave your avatar after applying the fix. |
|
|
|
|
sqzdog
|
Posted:
Tue Sep 23, 2003 8:47 pm |
|
Well Raven, this was my first time really getting in and altering code. Been playing with my phpnuke site for 2 months now. No experience whatsoever with web stuff before. Your directions to fix this problem were clear and concise and it worked like a charm. Thanks so much for all the help you have provided! |
|
|
|
|
Raven
|
Posted:
Tue Sep 23, 2003 8:50 pm |
|
Thanks for the feedback! I am so glad we are a little closer to getting these pesky bugs resolved. Now it remains to be seen if this fix makes it into the next release. Don't hold your breath |
|
|
|
|
sharlein
Member Emeritus
Joined: Nov 19, 2002
Posts: 322
Location: On the Road
|
Posted:
Wed Sep 24, 2003 7:50 am |
|
Raven, I applied this fix and it worked great. the only problem that I ran into wasQuote: | Then on or about linee 998 and also 1010, find this code
user_avatar='$user_avatar'
and change it to
user_avatar='gallery/$user_avatar'
| I didn't have that code at or near line 1010, but it still fixed my problems. Thanx, Steve |
|
|
|
|
jbutler
New Member
Joined: Sep 24, 2003
Posts: 3
|
Posted:
Wed Sep 24, 2003 7:16 pm |
|
When I attempt to upload an avatar, after making these mods, I get the following error msg:
Code:Warning: copy(./modules/Forums/images/avatars/443e7d7f3f723f0010229.gif) [function.copy]: failed to create stream: Permission denied in /www/html/ss/includes/usercp_avatar.php on line 267
|
Weird thing is, there is no line 267 in usercp_avatar.php.
Any thought as to what's going on?
Thanks for the assistance! |
|
|
|
|
Raven
|
Posted:
Wed Sep 24, 2003 7:26 pm |
|
You need to change the permissions on modules/Forums/images/avatars to 777 (on each folder, but not the contents) |
|
|
|
|
jbutler
|
Posted:
Wed Sep 24, 2003 7:32 pm |
|
Permissions! Ain't they a bear?
I checked the permissions on the directory into which the avatar was supposed to upload and found that it was NOT writeable by the Web server user. Changed it so it was and bada-bing! My avatars are uploading!
Thanks for your very useful mod! |
|
|
|
|
jbutler
|
Posted:
Wed Sep 24, 2003 7:33 pm |
|
Raven wrote: | You need to change the permissions on modules/Forums/images/avatars to 777 (on each folder, but not the contents) |
You're too quick for me!
As I was typing my permissions note, you posted the fix.
Now, that's service! |
|
|
|
|
|