PDA

View Full Version : Custom Avatars as Files (updated for vBulletin 2.2.2)


Kier
19 Mar 2001, 00:56
Updated for vBulletin 2.2.2, 5th February 2002

Since there has been so much demand for this, I wrote a hack that will allow you to store all your custom avatars as files, rather than in the mySQL database.

http://kier.3dfrontier.com/vbhacks/avatarasfile.gif

Doing this will have the following benefits: Avatars folder can be protected by .htaccess (Apache only) to prevent bandwidth stealing
No SQL queries or PHP code required to display custom avatars - server load decreases
No cacheing issues with Internet Explorer 5.5, so server bandwidth use should decrease The install script will make the necessary modifications to your database, install a control panel option to switch the file-based avatars on, and convert your existing custom avatars from the database into files.

All avatar options that are present when using the standard mySQL avatar system are still present, and users will not notice a difference in the interface.

Full instructions for altering your PHP files are included in the zip file.

Once you have made the necessary modifications to the PHP scripts, you should run the enclosed install_favatar.php script from your admin/ folder.

19 Mar 2001, 01:04
Hi kier,
does your system allow admin to set max avatar size (lets say 80 x 80) and a weight (lets say 3ko) ?

This worked with mysql storing , will it work with your sysem ?

19 Mar 2001, 01:06
Oh, and does it allow user to upload their files, switch from one avater to the other (and have the previous one replaced and eareased ) ?

19 Mar 2001, 01:08
Kier, you know what ? :)
It would be GREAT to port this system to attached files to :)

19 Mar 2001, 01:12
Originally posted by Sharg
does your system allow admin to set max avatar size (lets say 80 x 80) and a weight (lets say 3kb) ?

Oh, and does it allow user to upload their files, switch from one avater to the other (and have the previous one replaced and eareased ) ? Yes, All avatar options that are present when using the standard mySQL avatar system are still present

Originally posted by Sharg
Kier, you know what ? :)
It would be GREAT to port this system to attached files to :) I'm not really interested in doing this for attached files, partly for security reasons, and partly because storing attachments in the database does not have the same problems/disadvantages as the avatar system. The reason I have done this for avatars is mainly to solve a problem with IE's cache which causes avatars to be downloaded again for every page, leading to increased server load and bandwidth use.

19 Mar 2001, 01:22
Yes, All avatar options that are present when using the standard mySQL avatar system are still present

Ok, just wanted to make sure they worked with directory storing, as I thought these size and weight option were database storing specific.

Another question: do I need to set to 777 the directory storing the avatars ?

19 Mar 2001, 01:26
Originally posted by Sharg
Another question: do I need to set to 777 the directory storing the avatars ? Do the instructions say you have to? Have a read. http://kier.3dfrontier.com/vbhacks/avatarasfile.php

19 Mar 2001, 01:29
And I quote:

1) Firstly, you will need to create a new folder in your forums directory called custom_avatars and set the permissions on the folder to 777.

19 Mar 2001, 01:32
Just a last question before I try to install it:

I'm not really interested in doing this for attached files, partly for security reasons,

What's the security concern that attachement files folder storing involve that isn't involved by avatar folder storing ?

19 Mar 2001, 01:35
Originally posted by Sharg
What's the security concern that attachement files folder storing involve that isn't involved by avatar folder storing ? Avatars are always stored as xxxx.gif. Attachments can be of any file type that the administrator decides to allow. If an administrator decided to let .php files be uploaded, and they were stored as files on the system, anyone could run a php script that could destroy the server.

It's a bad idea.

19 Mar 2001, 01:41
Ok, got it, thanks Kier.
I didn't considered this cause I would only allow jpg,gif, txt and zip and would use it.

Anyway, good job with this hack. Gives the webmaster the final decision.

19 Mar 2001, 02:14
Another wonderful hack, thanks Kier.... I already have it installed and working on Me2Be's forums.

Just one small typo, in the control panel options, it says "Store Custom Avatars in Database?", but this has to be set to "yes" to use files, "no" to use the database. It should say "Store Custom Avatars as Files?". But otherwise it works great!

Thanks :)

19 Mar 2001, 02:23
Fixed :)

If you have this problem and want to correct it, run this query:

UPDATE setting SET title='Store Custom Avatars as Files?' WHERE varname='usefileavatar'

19 Mar 2001, 02:40
I just discovered that two php files that require modifications were not mentioned in the original documentation... please revisit the docs and follow the steps to modify private.php and announcement.php if you installed this hack prior to the posting of this message. :)

19 Mar 2001, 11:22
Kier, you are great! :)

Are all avatars stored as GIFs? Even those uploaded as JPGs? I'm asking because you said "Avatars are always stored as xxxx.gif".

19 Mar 2001, 11:26
Can you please make a hack for avatars that mods and admins can use custom, but any other group can't?

Or make it to where by group you turn on/off custom setting.

Under each group add

Can use custom avatar Yes/No

If you do modify for a group you'd see where it would be nice to have that setting.

Thanks

19 Mar 2001, 12:14
yet another fine hack well done kier btw when does your new website open to the general public ?

19 Mar 2001, 13:34
Originally posted by GameGalaxy
Can you please make a hack for avatars that mods and admins can use custom, but any other group can't?

You can already do this, in a round-about-sort-of-way. Just set Custom Avatars to No (in Options) then go into User > Find > username > Edit > change avatar and you can set a custom avatar even if it's disabled for the board at large.

19 Mar 2001, 15:58
kool hack Kier

19 Mar 2001, 17:18
Are all avatars stored as GIFs? Even those uploaded as JPGs? I'm asking because you said "Avatars are always stored as xxxx.gif".

Yes, even JPG file types. Rename a .jpg file to .gif and open it in your browser. It should display just fine.

19 Mar 2001, 18:16
They are just RENAMED to GIFs or are they converted to GIFs?

19 Mar 2001, 18:21
They are just RENAMED to GIFs or are they converted to GIFs?

There is no "conversion" from one type to another. The data is stored as binary, and when "displayed" using avatar.php, it adds header("Content-type: image/gif"); so your browser will believe it's a gif file. The contents of your jpg are unchanged, just sent to the browser as image/gif so it can be displayed.

19 Mar 2001, 18:22
Originally posted by -saturn-
They are just RENAMED to GIFs or are they converted to GIFs? They are just renamed to GIF. This also happens (in a roundabout sort of way) with custom avatars stored in the database (they send a content header which describes their content to the browser as 'image/gif')

19 Mar 2001, 18:25
problem with showthread.php, private.php, announcement.php, admin/functions.php logic.

If there exists a customavatar record for the poster, it works great. But if you deleted all the customavatar table records, there's a problem.

if ($post[hascustomavatar] and $avatarenabled) {
if ($usefileavatar) $avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
else $avatarurl="avatar.php?userid=$post[userid]";

hascustomavatar is false because customavatar.avatardata is null, therefore, it can never check to see if $usefileavatar is true or not. There needs to be a way of determining if a customavatar that's saved as a file exists for that user. Maybe checking avatarrevision > 0.

if ($post[avatarrevision]>0 and $usefileavatar and $avatarenabled) {
$avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
} else {
if ($post[hascustomavatar] and $avatarenabled) $avatarurl="avatar.php?userid=$post[userid]";
}

member.php - Also, when a customavatar is deleted or changed to a predefined avatar, the user record needs to be updated to change avatarrevision=0.

Let me know if I am way off base here.

19 Mar 2001, 18:45
You're right. I'll look into it.

19 Mar 2001, 18:51
I know you can already do this, but this isn't the way it should be done. Its a pain if users want to change all the time or test new ones out.



Originally posted by tubedogg


You can already do this, in a round-about-sort-of-way. Just set Custom Avatars to No (in Options) then go into User > Find > username > Edit > change avatar and you can set a custom avatar even if it's disabled for the board at large.

19 Mar 2001, 19:44
As Pfunk pointed out, there was a logic error which occurred if you deleted the contents of your customavatar table...

I did sat in the instructions and in the install script that I did not recommend that you empty the custom avatar table unless you really (really) had a good reason to do so.

In any case, the code is now fixed. Visit the instructions page (http://kier.3dfrontier.com/vbhacks/avatarasfile.php) and make the necessary modifications to member.php - the other files do not need to be altered if you have already hacked them.

If any of your members' avatars are not showing up, simply get them to re-upload their avatar and it will fix itself.

19 Mar 2001, 19:55
Thank you Kier!

19 Mar 2001, 20:14
Originally posted by pestilence
yet another fine hack well done kier btw when does your new website open to the general public ? not yet (http://vbulletin.com/forum/showthread.php?postid=http://vbulletin.com/forum/report.php?s=&postid=78048#post78048) ;)

19 Mar 2001, 20:34
Another great hack Kier!
Thanks a lot

19 Mar 2001, 21:19
Another stunning effort. Just one question. I know you have been in close connection with the developers on this issue, so do you know if this hack will be in Beta 4? I just don't want to install it then re-install when beat 4 comes out.

19 Mar 2001, 21:32
Ok, this is the final thorn I will use today.

How about one last modification to avatar.php to prevent bandwidth stealers from circumventing the security measures people may put on the custom_avatars folder. Only bring this up because now there is a customavatar record again.

Either returning nothing, or the clear.gif image.

Ok, that's it... I promise. =) No, really! heheheh

Great work on the hack, and responding so quickly with a fix to the previous post of mine.

19 Mar 2001, 21:55
one more kier
you are the best of the best!

19 Mar 2001, 23:15
Originally posted by PFunk
Either returning nothing, or the clear.gif image. Easy, if you use avatars-as-files, just edit avatar.php and at the top of the file, under <?php just put

exit;

I'm not going to do anything more fancy than that, as it would add extra queries to avatar.php, which I am not prepared to do.

20 Mar 2001, 00:16
If you installed the hack previous to this message, please revisit the instructions and follow the steps to modify admin/user.php... I completely forgot to hack that file before :rolleyes:

20 Mar 2001, 04:15
<< removed >>

20 Mar 2001, 04:58
Originally posted by PFunk
Add this:

require("./global.php");
if ($usefileavatar) exit;

This will cause avatar.php not to return the graphic if Use File Avatars is enabled, otherwise, it works as before. Oh my god do you not want to add that!!!!

If you use require("./global.php") in avatar.php, you will be executing huge numbers of queries every time an avatar is displayed...

This code should really (really) not be added!

30 Mar 2001, 17:55
Kier,

Great hack! This should speed up my forum a lot.

One thing before I install this hack. Will the database change that this hack does cause any problems when I upgrade to beta4? (Other than changing the php files of course)

Thanks again!

30 Mar 2001, 21:51
Hello Kier,

Would I be able to use this hack in conjunction with upgrading my 1.13 forum.

See, right now the current VB 2.0 upgrade1.php script does not upgrade my "custom_avatar" table from freddies VB 1.13 "Custom Avatar HAck"...which means my users will have to all re-upload their custom avatars.

You seem to be a hack master around here lately...do you think you could figure it out?

If so here is the information:
Here is my old 1.13 "custom_avatar" table:

CREATE TABLE custom_avatar (
id int(6) NOT NULL auto_increment,
bin_data longblob NOT NULL,
filename varchar(50) NOT NULL,
filesize varchar(50) NOT NULL,
filetype varchar(50) NOT NULL,
userid int(10) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
UNIQUE userid (userid),
KEY userid_2 (userid)
);


And here is the new VB 2.0 "customavatar" table:

CREATE TABLE customavatar (
userid int(10) unsigned DEFAULT '0' NOT NULL,
avatardata mediumtext NOT NULL,
PRIMARY KEY (userid)
);


Anything you could do to help me salvage my current user's custom avaatrs would be fantastic. Even if it means upgrading the custom avatars into your hack...which I want to store them outside the database anyway.

Thanks for your time. :)

30 Mar 2001, 21:59
drop the new customavatar table.

rename custom_avatar to customavatar.

Drop the fields id, filename,filesize, & filetype

rename bin_data to avatardata, change the type to mediumtext.

Drop the second index userid_2

p.s. now watch your avatars blow up in size as my hack made no checks on image height/width, only filesize. It used img tags to force all images to be the same size when displayed.

DVD Plaza
10 Apr 2001, 07:32
This might be a silly question (sorry!), but why isn't this a part of the official product?

TechTalk
12 Apr 2001, 04:23
Originally posted by DVD Plaza
This might be a silly question (sorry!), but why isn't this a part of the official product?

I would like to know too....

Kier, can we just make sure all of your hacks make it in the final releases? I would be a much happier man

~Chris

Freddie Bingham
12 Apr 2001, 04:40
It will be part of 2.1

jojo85
12 Apr 2001, 05:49
Nice :D

VirtueTech
14 Apr 2001, 10:40
Thank you very much Kier

TooHectic
15 Apr 2001, 04:58
does this work with beta 5?

I ran the install_db2fileavatars.php, at started to edit the files, but I noticed that the files were a little different for beta 5. For instance, the first modification step adjusts the functions.php file, and one of the original lines is
return "avatar.php?s=$session[sessionhash]&userid=$userid";

But this line looks like this in beta 5
return "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";

Can I still proceed with the rest? In fact, I had origianlly decided to stop, but the install_db2fileavatars.php already changed some things...... so I can't even set any custom avatars as it stands right now. I get a blank screen after I submit the settings for uploading the avatar. Can I fix this, or can I just continue with the hack? :confused:

VirtueTech
15 Apr 2001, 05:03
I proceeded and it worked great with beta 5

TooHectic
15 Apr 2001, 09:20
Thanks... I'll try it tomorrow.

CityNet
16 Apr 2001, 09:36
Arrgh.. I did this hack, entirely as instructed and when going into the Change Profile page I get this:

Parse error: parse error in /usr/local/plesk/apache/vhosts/thecitynetwork.net/httpdocs/forums/member.php on line 1042

What happened?

TomLloyd
16 Apr 2001, 15:05
Thanks for this hack Kier.

We had to disable avatars on our site because the amount of people uploading to the Db crashed our server! (RaQ 4)

Have re-enabled avatars now, much thanks.

(I'm using beta 5, and I noticed no problems installing btw)

CityNet
16 Apr 2001, 19:59
Originally posted by CityNet
Arrgh.. I did this hack, entirely as instructed and when going into the Change Profile page I get this:

Parse error: parse error in /usr/local/plesk/apache/vhosts/thecitynetwork.net/httpdocs/forums/member.php on line 1042

What happened?

Finally got around to installing Word and figuring out how to turn on line numbering... What? Line 1042 is just some commented file?

I tried uploading it again. It worked this time.. Thanks. ^_^

((EDIT: Tried entering a URL for an avatar and STILL keep getting "This is not a valid GIF or JPG file. Please ensure that it is and try again"

That's it... I'm going to cuddle up in a fetal position and just cry. Trying to get these avs to work is going to result in me tearing my hair out)

SpankMe
20 Apr 2001, 00:15
What we really need is a utility that will go through the MySQL dB and convert all image attachments to files and update the associated post. We could then cron it to run every so often.

I like allowing users to attach images but it is a REAL PAIN for them to download the images every time they visit the thread :(

eiko
11 May 2001, 01:05
After installing this hack (which is Awesome by the way)...
When you click a user's profile link, returns this error:

Warning: Object DB_site not found in /home/name/dir/forums3/member.php on line 1037

Fatal error: Member function used on a non-object in /home/name/dir/forums3/member.php on line 1037

RC2

eiko
11 May 2001, 22:33
anyone?

eiko
12 May 2001, 15:25
Maybe I asked this question in the wrong forum?

eiko
12 May 2001, 15:47
Well no wonder no one replied...
Sorry... BONEHEAD mistake on my part.

uhh...

in my best Gilda Radner.... Nevermind.

Dakota
15 May 2001, 19:09
Is there anyway that there could be an option for just mods and admins be able to select custom avatars?

TGO
18 May 2001, 01:22
I tried to install this on RC3 and got a datbase error..I REALLY need this hack too. :\

BTW, the error is when I run the install script, I press Install and I get a database error. Whether I have created the custom_avatars directory or not..

Error is:
---
There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.
----

Please help with this one Kier..

ForzaGrifo
20 May 2001, 03:51
Kier, I've got RC 3 too and I really want this hack. Will I get the same problem as TGO's? Thanks.

Cid Kramer
20 May 2001, 12:53
I'm in the same boat as TGO the hack is needed badly too, any help would be greatly apriciated.

Sven
22 May 2001, 10:11
Tried to install into Final Release... but got stuck while editing functions.php....

The lines to replace are not matching the installation description.... :(

Will there be any update on the hack for the Final????

It would be really nice to get it working, currently Avatars on our Forums are disabled due to traffic but i'd like to offer this to our users.

Fiyah
22 May 2001, 11:52
Originally posted by Kier
Yes, All avatar options that are present when using the standard mySQL avatar system are still present



where would you change the max size at?

ForzaGrifo
22 May 2001, 20:17
Originally posted by Sven
Tried to install into Final Release... but got stuck while editing functions.php....

The lines to replace are not matching the installation description.... :(

Will there be any update on the hack for the Final????



Yeah, I would like to know the instructions for installing into 2.0 Gold as well. Can anyone help?

PeterS
23 May 2001, 03:32
just wanted to note works dandy with the 2.0.0 release. read to re-tweak the files but all is happy once again.

Great Hack, many thanks

http://forums.sobservers.com

ForzaGrifo
23 May 2001, 20:20
Hey PeterS, cool site! where did you get that cool news fader?

Luciano
24 May 2001, 08:57
sorry if i'm off topic,
but i was wondering..
if i have lets say 600 avatars
wouldn't it be nice to have categories like:
Male avatars,
female avatars
simpson avatars
,,,, avatars..

with about 80 each...

would be user and server friendly...

or am I wrong???

Luc

jucs
25 May 2001, 12:01
If I install this hack for example, what are the risks? I assume if a 2.1 version came out I would have to reinstall? Would it affect say converting from 2.0 to 2.1 down the road?

Sorry if this is a dumb question. I just don't want to sprint before I walk with VB. :)

Sven
25 May 2001, 23:05
as announced in the Suggestions & Feedback Thread the Hack will be part of the next version....

But still:
I need some Instructions for this hack to get it installed in vB2.0.0...
Is there anybody who successfully installed it in the final release and could tell me what to do?

jucs
26 May 2001, 01:25
Ditto...I would like to install it into V2.0 final.

eva2000
26 May 2001, 01:27
Originally posted by PeterS
just wanted to note works dandy with the 2.0.0 release. read to re-tweak the files but all is happy once again.

Great Hack, many thanks

http://forums.sobservers.com great the next hack i need to add :D

jucs
26 May 2001, 02:45
What does Read to re-tweak mean?

jucs
27 May 2001, 14:46
Answer Sven and my questions? Thanks.

Sven
27 May 2001, 16:13
So here's a bit of the problem:
admin/functions.php as per instructions:
function getavatarurl($userid) {
global $DB_site,$session;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom FROM user LEFT JOIN avatar ON avatar.avatarid=user.avatarid LEFT JOIN customavatar ON customavatar.userid=user.userid WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
return "avatar.php?s=$session[sessionhash]&userid=$userid";


admin/functions.php in vB2.0.0 Final Release:
function getavatarurl($userid) {
global $DB_site,$session;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
return "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
} else {
return '';
}
}
}

You see that tiny differences?
So is there anyone out there who could tell me what to do?

nuno
27 May 2001, 16:59
tx Kier
works with 2.0.0 release also

functions.php

find:

function getavatarurl($userid) {
global $DB_site,$session;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
return "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
} else {
return '';
}
}
}

replace with:

function getavatarurl($userid) {
global $DB_site,$session,$usefileavatar;


if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,avatarrevision,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
if ($usefileavatar) return "custom_avatars/avatar$userid"."_$avatarinfo[avatarrevision].gif";
else return "avatar.php?userid=$userid";
}
}
}

Freddie Bingham
27 May 2001, 17:01
sven the code looks the same .. it just appears I got to it and broke the sql up into multiple lines which I have a habit of doing.

Wayne Luke
28 May 2001, 07:10
Originally posted by freddie
sven the code looks the same .. it just appears I got to it and broke the sql up into multiple lines which I have a habit of doing.

Only because it is a lot easier to read and comprehend.

jucs
28 May 2001, 17:26
The code replace for announcement.php is incorrect?? I can only find this:

if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";


Note it is different from this in the instructions:

if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?s=$session[sessionhash]&userid=$post[userid]";


What gives? I have final 2.0.

Sven
28 May 2001, 17:31
Well, that's almost the same question I have.... what about the
&dateline=$post[avatardateline]" thing?
Do I have to add this at the appropriate places or is it not mandatory?

I got the Avatar_as_files option working on my local testinstallation with the replacements from the instructions but I'm not sure if I can use this on the production environment w/o causing bugs due to the changes.

jucs
28 May 2001, 17:46
I just started with that file...are there any more of these discrepencies?

Sven
28 May 2001, 20:45
@jucs:

I edited all of the files now to add the "dateline"...
It's in all files but member.php, in most of them you just need to add the
&dateline=$post[avatardateline]"

but in user.php it's different, take care of that one!

In my local installation it seems to work - after I changed the files ;)

jucs
29 May 2001, 00:59
I wish the documenation was updated. Now I don't trust myself as there are several "got ya's" due to inaccurate documention for V2.0 and you can't systematically follow exact directions. <sigh>

ForzaGrifo
29 May 2001, 22:01
Can someone update the hack install documentation so that 2.0 gold users will know exactly what to do? Thanks.

Sven
30 May 2001, 08:47
Well, that's what we're asking for.... I already send out a PM to Kier (about a week ago)... but got no response :(

You may want to do the same as I have the assumption that he doesn't look into this thread at the moment.

ForzaGrifo
30 May 2001, 18:29
hey, may be the guy is busy.:o

rebby
31 May 2001, 20:05
if this will be included in 2.1... i'm really curious on the 2.1 eta... would it be worth my time to hack 2.0???

CoolaShacka
06 Jun 2001, 00:11
updating the Instructions woukd be very nice.

Tnx

TooFastForYa
06 Jun 2001, 05:12
Originally posted by Sharg
Kier, you know what ? :)
It would be GREAT to port this system to attached files to :)

I agree with Sharg...I have been looking for this hack for a long time no with no success. It should be made for the people with smaller databases with large webspace, that want to attach larger files. Please look into making this hack...It would be greatly appreshated!
Thanks,
TooFastForYa

jucs
06 Jun 2001, 18:36
I would just go for getting the documenation updated. :(

Dakota
07 Jun 2001, 05:22
Great hack, I love it, just been holding out on installing it. It installed without any problems. I really like the installer that is coming with these hack, it really saves time.

Edit: the dateline you guys are talking about didn't affect it when I installed it. I just acted like it wasn't there, and just put what is in the installation instructions. It works fine without the dateline stuff.

cditty
09 Jun 2001, 08:44
Would this be easily modified to allow users to serve their avatars from their web server?

Figure it might save a lot of bandwidth if I allow custom avatars and require them to be served elsewhere.

Chris

huythuy
10 Jun 2001, 21:44
Thanks for this hack .

How can I have "custom_avartars" in another folder not the vBB fodler ? Coz I want a share avatars folder with another forum and gallery .

Thanks in advance

huythuy
15 Jun 2001, 21:19
Please anyone ?????? :(

Tolitz
23 Jun 2001, 09:20
Has anyone been able to make this work on VB 2.0.1? What changes in the instructions did you do? I "really" like to incorporate this hack coz it'll save me valuable database space, as well as protect my avatar images with mod_rewrite ...

Anyone care to update the instructions? please? :(

ztsky
23 Jun 2001, 16:12
Originally posted by Tolitz
Has anyone been able to make this work on VB 2.0.1? What changes in the instructions did you do? I "really" like to incorporate this hack coz it'll save me valuable database space, as well as protect my avatar images with mod_rewrite ...

Anyone care to update the instructions? please? :(

Check my board (http://www.chinavbb.com)

ztsky
23 Jun 2001, 16:34
See this,I edit this hack from Kier.
It works well on my board vb2.0.1.
this zip include two files. install_db2fileavatars.php adn install.txt.
Unzip this zip,upload and run install_db2fileavatars.php in your board admin dir.Then edit and upload your file as install.txt.
Good luck!

Christian
26 Jun 2001, 11:52
When the hack is installed and all files are stores in the folder, is it safe to empty the custom_avatar table then?

Dimitri
30 Jun 2001, 00:25
Only problem with ztsky's version of this hack is that the avatar will no longer display on the profile page, whether it's your edit profile page or someone else's view profile page. Can you modify the 'hack' in the members.php file so it still shows it in profile pages? Works fine otherwise. ;)

ztsky
02 Jul 2001, 21:00
Originally posted by Dimitri
Only problem with ztsky's version of this hack is that the avatar will no longer display on the profile page, whether it's your edit profile page or someone else's view profile page. Can you modify the 'hack' in the members.php file so it still shows it in profile pages? Works fine otherwise. ;)

just like this
in member.php,
1ˇ˘find :
$userinfo[avatarurl]=getavatarurl($userinfo[userid]);
if ($userinfo[avatarurl]=="") {
$userinfo[avatarurl]="images/clear.gif";
replace with this:
$userinfo[avatarurl]=getavatarurl($userinfo[userid]);
if ($userinfo[avatarurl]=="") {
if ($userinfo[avatarrevision]>0) {
$userinfo[avatarurl]="custom_avatars/avatar$userinfo[userid]"."_$userinfo[avatarrevision].gif";
} else
$userinfo[avatarurl]="images/clear.gif";

2ˇ˘find

if ($bbuserinfo[avatarurl]=="") {
$bbuserinfo[avatarurl]="images/clear.gif";

replace with this:
if ($bbuserinfo[avatarurl]=="") {
if ($bbuserinfo[avatarrevision]>0) {
$bbuserinfo[avatarurl]="custom_avatars/avatar$bbuserinfo[userid]"."_$bbuserinfo[avatarrevision].gif";
} else
$bbuserinfo[avatarurl]="images/clear.gif";

ForzaGrifo
16 Jul 2001, 08:39
Originally posted by Dakota

the dateline you guys are talking about didn't affect it when I installed it. I just acted like it wasn't there, and just put what is in the installation instructions. It works fine without the dateline stuff.

I've got 2.0.0. So do I just ignore the dateline stuff and put what's in the installation instruction? Will it really work?

I'm hesitant of hacking the code unless I'm 100% sure it will work and not crash.

btw can somebody update the instruction for 2.0.x users?

ztsky
16 Jul 2001, 12:02
Originally posted by ForzaGrifo


I've got 2.0.0. So do I just ignore the dateline stuff and put what's in the installation instruction? Will it really work?

I'm hesitant of hacking the code unless I'm 100% sure it will work and not crash.

btw can somebody update the instruction for 2.0.x users?

http://161.58.84.213/forum/showthread.php?threadid=22115

Mr. X
25 Jul 2001, 10:23
Fatal error: Failed opening required './global.php' (include_path='') in /home/mx3dm1/public_html/vb/admin/install_db2fileavatars.php on line 2

This is what I get. Im using php3 files since vB refuses to install when I use .php.

Im wondering, can I just change the .php in your installer file to .php3?

Also, when you say:

1) Firstly, you will need to create a new folder in your forums directory called custom_avatars and set the permissions on the folder to 777.

Do you mean create in the root forum folder, or in the /images folder? If not, do I need to move all the other avatars in my images/avatars folder to the new one?

Mr. X
29 Jul 2001, 21:38
Bump. Come on, no one?

VirtueTech
30 Jul 2001, 06:15
Doesn't 2.0.1 include this hack already?

Same with attachments?

Scoty
31 Jul 2001, 06:01
There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.
An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.


Database error in vBulletin Control Panel: Invalid SQL: ALTER TABLE user ADD avatarrevision INT (6) UNSIGNED DEFAULT '0' not null AFTER avatarid
mysql error: Duplicate column name 'avatarrevision'
mysql error number: 1060


i have vBulletin 2.0

TheProfessor
07 Aug 2001, 09:50
How to apply this hack in vB 2.0.3?

showthread.php changed completly, I just cannot replace some code, because it is not there.

Kier or Freddi, please?

Greetings, The Professor!

eXtremeTim
07 Aug 2001, 10:36
in the newer version ov vb it seems that the users only have to hack member.php and admin functions.php and the hack seems to work fine.

TheProfessor
07 Aug 2001, 13:32
Yes, in fact it works fine, but just when viewing the member's profiles or private messages.

When showing threads, avatars will be still loaded from the SQL-Server.

Greetings, The Professor!

eXtremeTim
07 Aug 2001, 14:26
yea i just noticed that so you just have to hack the showthread file up.

eXtremeTim
07 Aug 2001, 14:47
i did some searching and found were the coding to hack up is at now so latter tonight i will see about releasing a new version of this hack for vbulletin 2.0.3

Castel
10 Aug 2001, 02:07
Any progress in getting this to work properly for 2.0.3 showthread?

HalfBreed
12 Aug 2001, 21:00
**BUMP**

Dakota
17 Aug 2001, 08:14
Here's how to get it working in 2.0.3

In admin/functions/php, announcement.php and private.php

Find:
if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";

and replace it with:
if ($post[hascustomavatar] and $avatarenabled) {
if ($usefileavatar) $avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
else $avatarurl="avatar.php?userid=$post[userid]";

Christian
17 Aug 2001, 20:51
Do you have to run the install again after upgrading?

If so, which one did you use?
The original or the one of the modified hack?

Castel
23 Aug 2001, 19:07
Dakota, that's the exact same code as the original hack. I am aware that the showthread.php changes are now in functions.php but this doesn't make it work.

Look at the source code of a thread with a custom avatar and you will see the avatar is still img src=avatar.php.... while on other pages that display the avatar it does indeed come for the custum_avatars folder.

Lordmusic
25 Aug 2001, 01:39
Keir, buddy. Please rerelease an update for your hack!!! It is needed.

dost
25 Aug 2001, 03:41
Yes please I also want to use this hack with vB 2.0.3

centris
25 Aug 2001, 17:09
Would someone PLEASE start a new thread for 2.03 hacks. I ran the install script and then found that the code did not match, now I have to wait for an update.

Sven
29 Aug 2001, 18:54
Mhmm, if just Kier would look into here and post something like:

Yes, I'm going to update, be patient

or at least

No, I'm too busy, sorry

pier
04 Sep 2001, 15:14
Any news yet ? My forum needs this mod to work!
thanks for your great feature

pier

tamarian
05 Sep 2001, 01:05
I have a guess why Kier didn't update the hack.

It's already done on the vB 2.0.4 waiting for release! :D

Lordmusic
05 Sep 2001, 02:01
Unless this hack is done, none of my members can change their avatars :-/

Sven
06 Sep 2001, 23:07
^bump^this^a^little^ ;)

DarkReaper
06 Sep 2001, 23:47
You state that you can use .htaccess to prevent the files from being linked from outside my server...how would I do this? Place a .htaccess file in the forums directory with what contents? Thanks.

eva2000
06 Sep 2001, 23:51
Originally posted by DarkReaper
You state that you can use .htaccess to prevent the files from being linked from outside my server...how would I do this? Place a .htaccess file in the forums directory with what contents? Thanks. use http://faq.solutionscripts.com/misc/hot_linking.html

DarkReaper
07 Sep 2001, 00:09
Thanks :)

kaeros
07 Sep 2001, 17:22
I just recently installed this hack and now I notice that the forum doesn't update the numver of views where before it did. Is this happening to anyone else?

Lordmusic
15 Sep 2001, 20:15
This hack needs to be updated for 2.0.3 ! ! !

Cocomiel
15 Sep 2001, 22:11
Please Update the hack ... why you didnt yet ?
Its one of the bests hacks outhere

Cocomiel
15 Sep 2001, 22:12
Ok, i will code this one, will be ready in two days

DarkReaper
15 Sep 2001, 23:56
um..the installation link isn't loading.

dost
21 Sep 2001, 16:44
two days passed :P how is it going?

Cocomiel
21 Sep 2001, 19:50
you should look here :


http://www.vbulletin.com/forum/showthread.php?threadid=28337

DarkReaper
02 Nov 2001, 04:28
How can I get this to work with 2.2.0?

psico
03 Nov 2001, 11:33
Not work with 2.2.0 !!!!


this code not exist!!!

showthread.php
and
private.php
and
announcement.php find this:

if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?s=$session[sessionhash]&userid=$post[userid]";
replace with this:

if ($post[hascustomavatar] and $avatarenabled) {
if ($usefileavatar) $avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
else $avatarurl="avatar.php?userid=$post[userid]";

Cocomiel
03 Nov 2001, 16:38
This hack was for 2.0, i dont have idea why they put 2.2.0

eva2000
03 Nov 2001, 16:42
must of been devine intervention since twice i tried to install this hack and when i read this thread my browser frooze and forced me to reboot my pc :)

eg_92901
15 Nov 2001, 19:19
Is this supported on vBulletin 2.2.0? I see different code than what is in the instructions for the function.php file.

ladyfyre
30 Nov 2001, 04:49
I would also be quite interested in the answer to that question :)

Since our database is already over 300MB it takes FOREVER to do a dump.sql file, and i will have to move to another server AGAIN in a few days, since we are finally ready to ship our colo box.

SirSteve
03 Dec 2001, 00:41
What about 2.2.1?

bira
03 Dec 2001, 02:03
OK, for those wishing to install this in 2.2.1:

Follow the instructions in post #1 except for the following change:

the instructions for file admin/functions.php should be:


Find:


// ###################### Start getavatarurl #######################
function getavatarurl($userid) {
global $DB_site,$session;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
return "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
} else {
return '';
}
}
}


Replace with:


// ###################### Start getavatarurl #######################
function getavatarurl($userid) {
global $DB_site,$session, $usefileavatar;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,avatarrevision,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
if ($usefileavatar) {
return "custom_avatars/avatar$userid"."_$avatarinfo[avatarrevision].gif";
} else {
return "avatar.php?userid=$userid";
}
} else {
return '';
}
}
}


Find:


if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";


Replace with:


if ($post[hascustomavatar] and $avatarenabled) {
if ($usefileavatar) {
$avatarurl="custom_avatars/avatar$post[userid]_$post[avatarrevision].gif";
} else {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
}




And, no changes should be made to showthread.php.


That's it. All other instructions remain the same.

Cheers,

Bira

eva2000
03 Dec 2001, 05:10
thanks Bira :D

Dark Blaze
05 Dec 2001, 20:31
Great Hack Kier, congrats :)

Dark Blaze
05 Dec 2001, 20:32
Also, thanks Bira for making this hack available for 2.2.1 version forums :)

SirSteve
05 Dec 2001, 20:47
What happens to the current custom avatars my members are using if I install this hack?

bira
05 Dec 2001, 23:56
Originally posted by SirSteve
What happens to the current custom avatars my members are using if I install this hack?

If you follow the hack's installation instructions accurately and run the script, the avatars will be converted to gif files. From the user standpoint, he will see absolutely no difference: his custom avatar will continue to show up as normal. The only difference is that instead of it being <img src="avatar.php?userid=xxx"> it will be <img src="custom_avatars/xxx.gif"> (or something like that)

DarkReaper
06 Dec 2001, 00:25
For those interested, I rewrote Kier(I think? maybe it was tubedogg...)'s version of the hack to 2.2.1. It works on mine just like the old one did. If you're interested, I could write up the code changes and post them...

bira
06 Dec 2001, 00:30
DarkReaper, I think that's what I did some 6 or so posts up :D

SirSteve
06 Dec 2001, 00:34
So you still change private.php and announcement.php? I don't have this code in mine:

if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?s=$session[sessionhash]&userid=$post[userid]";

bira
06 Dec 2001, 00:38
SirSteve, the respective code in those two files would be:


if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";

Lesane
15 Dec 2001, 15:42
Does this hack work in 2.0.3? ;)

Gutspiller
15 Dec 2001, 16:30
I have a problem. I am at the point of making the changes to my function.php file, but I don't have the code you specified to search for, but I do have this code:


function getavatarurl($userid) {
global $DB_site,$session;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
return "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
} else {
return '';
}
}
}


It's code for a smaller hack I installed that gives your avatar a url, so people can click on the avatar and be taking to their website or whereever they assign it to in their profile.

I would really like to install this hack, but since I have no idea what I am doing I need help. What part of the code do I replace, and what part of the code do I need to leave?

Any help will be greatly appreicated.

Thanks!

MaSTaKiLLaH
15 Dec 2001, 19:33
Hi,

i can't find the following code in the member.php :


$filenum=@fopen($filename,"r");
$filestuff=@fread($filenum,$filesize);
@fclose($filenum);

@unlink($filename);

if ($avexists=$DB_site->query_first("SELECT userid FROM customavatar WHERE userid=$bbuserinfo[userid]")) {
$DB_site->query("UPDATE customavatar SET avatardata='".addslashes($filestuff)."' WHERE userid=$bbuserinfo[userid]");
} else {
$DB_site->query("INSERT INTO customavatar (userid,avatardata) VALUES ($bbuserinfo[userid],'".addslashes($filestuff)."')");
}
}
} else {
$avatarid=verifyid("avatar",$avatarid);
$avatarinfo=$DB_site->query_first("SELECT minimumposts FROM avatar WHERE avatarid=$avatarid");
if ($avatarinfo[minimumposts]>$bbuserinfo[posts]) {
eval("standarderror(\"".gettemplate("error_avatarmoreposts")."\");");
// not enough posts error
exit;
}
$DB_site->query("DELETE FROM customavatar WHERE userid=$bbuserinfo[userid]");
}
} else {
$avatarid=0;
$DB_site->query("DELETE FROM customavatar WHERE userid=$bbuserinfo[userid]");
}


Can anybody help me please ?

Sadie Frost
24 Dec 2001, 02:51
MaSTaKiLLaH, I had the same problem in 2.2.1

What I did (and seems to be working so far lol) is first off, look for

$filenum=@fopen($filename,"rb");

But what I did on this file and admin/user.php, is just compare the find & replace codes in the directions, and see what had changed. Then I only made those changes (so if there were other differences that were supposed to be there, I didn't mess them up.)

There are three changes to each file:

For member.php, (1) you just need to add this at the top, before $filenum=@fopen($filename,"rb"):


if ($usefileavatar) {// store avatars as files

@unlink("custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");
copy($filename,"custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]+1).".gif");
$DB_site->query("UPDATE user SET avatarrevision=avatarrevision+1 WHERE userid='$bbuserinfo[userid]'");

}


then after (2)

"exit;

}"

and after (3):

"$avatarid=0;"

add:


if ($usefileavatar) @unlink("custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");



For admin/user.php, (1) you just need to add this at the top, before $filenum=@fopen($filename,"rb"):


if ($usefileavatar) {// store avatars as files

@unlink("../custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");
copy($filename,"../custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]+1).".gif");
$DB_site->query("UPDATE user SET avatarrevision=avatarrevision+1 WHERE userid='$bbuserinfo[userid]'");
}


then after (2)

"//exit;

//}"

and after (3):

"$avatarid=0;"

add:


if ($usefileavatar) @unlink("custom_avatars/avatar$bbuserinfo[userid]_".($bbuserinfo[avatarrevision]).".gif");


Also, bira's instructions for 2.2.1 may need to be amended (though it also might have just been me as well)

She has:

if ($usefileavatar) {

return "custom_avatars/avatar$userid"."_$avatarinfo[avatarrevision].gif";


But I got a parse error in the "if ($usefileavatar) {" line when I went to my admin cp options. So I made that line as in Kier's instructions - leaving out the "{".

I hope this is helpful - sorry if it's confusing :)

Spankers
24 Dec 2001, 07:21
Can someone please provide a link or post a reply here with a COMPLETE and CORRECT guide to the appropriate code replacements for this hack to support 2.2.1? I browsed through the pages of this thread and found all sorts of different posts referencing independent code replacements for individual files, many of which are STILL not correct.

Since this hack has the "v2.2.1" in the thread title, I think an updated installation guide would be appropriate. This is incredibly confusing and per the instructions and "reinstructions" provided I have yet to find all the correct code to replace.

Sadie Frost
26 Dec 2001, 14:19
bira's instructions work fine, actually

just look for "rb" instead of "r" and take out that extra {if you get a parse error

mvigod
11 Jan 2002, 18:06
Originally posted by Spankers
Can someone please provide a link or post a reply here with a COMPLETE and CORRECT guide to the appropriate code replacements for this hack to support 2.2.1? I browsed through the pages of this thread and found all sorts of different posts referencing independent code replacements for individual files, many of which are STILL not correct.

Since this hack has the "v2.2.1" in the thread title, I think an updated installation guide would be appropriate. This is incredibly confusing and per the instructions and "reinstructions" provided I have yet to find all the correct code to replace.

A 2.2.1 update would be great because it seems like all the 2.2.1 updates here are scattered. I would love to install this but don't want to make a mistake.

PK-Fortis
14 Jan 2002, 12:14
I just wanted to say that this is a great hack. I have very limited space in my MySQL database, and for the longest time I had to take avatar submissions and manually ad them to the list with a name so they'd be reserved under the 'honor system'. Now, I can just let people pick their own avatars, and still get a chance to moderate them. Thanks.

Jawelin
15 Jan 2002, 13:53
Originally posted by Dark Blaze
Also, thanks Bira for making this hack available for 2.2.1 version forums :)
Sorry but - me too - have found in this long thread a lot of CONFLICTING solutions and got confused at all.

Even, lookin' at Bira's homepage, I found the 2.0 hack only....
I agree the [2.2.1] prefix on the post means the hack itself is upgraded to work on that version.... THE HACK, not a dozen of answers from everybody to the original author..

Thank you

mvigod
15 Jan 2002, 16:06
Ok..I'll plead a little bit!

Bira, PLEASE put the correct changes into a new zip for download for all the 2.2.1 users. I know I could eventually figure it out but want to minimize the downtime risk and do it right the first time as we have 100-300 simulataneous users and they get unruly when your down for long!

Out of curiousity...is there a way to set this up so the avatars can be uploaded and served off of a dedicated image server instead of the server vbulletin is running on? I am looking to run webserver on dedicated server 1, database on server 2 and images on server 3.

THANKS!

ScottW
23 Jan 2002, 05:45
^ bump

Cocomiel
23 Jan 2002, 06:05
The REAL working hack be found here (htp://www.vbulletin.org/forum/showthread.php?s=&threadid=28337)

but Bira will try to continue bumping this thread forever (although he stolen my code, and his instructions still does not works) to stop people downloading my hack (which in fact, works) that have more features and allows you to select the custom avatars folder and no file modifications are needed to install).

Such attitude stopped me in releasing other hacks i've developed.

Bira, you should help the vB community, not Kier.
You can BAN me, i dont care

FWC
23 Jan 2002, 06:20
Originally posted by Cocomiel
but Bira will try to continue bumping this thread foreverHuh? What are you talking about? Bira hasn't posted in this thread since December 5. I would hardly call that bumping. Of course, you just bumped this thread with your post. :)

Jawelin
25 Jan 2002, 18:42
Originally posted by Jawelin

Sorry but - me too - have found in this long thread a lot of CONFLICTING solutions and got confused at all.

Even, lookin' at Bira's homepage, I found the 2.0 hack only....
I agree the [2.2.1] prefix on the post means the hack itself is upgraded to work on that version.... THE HACK, not a dozen of answers from everybody to the original author..

Thank you

I'm bumpin'up now ... :rolleyes:
I gov very confused by this contest; more, as I have very hacked 2.2.1 board , none of the installer works correctly as they don't find the strings!

Could someone put an END WORD to this challenge ?
Neither I agree with the sentence 'this isn't updated any more because it'll be released NEXT YEAR with vb3 ...

What are the difference between Kier's (Bira's) and Cocomiel's ones ?

Thanks a lot.

Jawelin
27 Jan 2002, 13:59
Originally posted by bira
DarkReaper, I think that's what I did some 6 or so posts up :D Sorry but member.php and user.php are much different than the Kier's 2.0 version.
So many of us got confused when trying to replace - even by hand - a non existing or different texts.
Even the Cocomiel's (http://www.vbulletin.org/forum/showthread.php?s=&postid=216250#post216250) version doesn't resolve the problem, as each of ones seems a slight cut & paste of the other ones ....
:surprised :mad:

:confused:

Is it possible after SIX MONTHS of challenge, none of you gave a DECENT version of this hack ?

Sorry for my phrases, but I think it isn't acceptable from coder or people they want to help some other.

Thanks

Jawelin
05 Feb 2002, 10:37
Finally, could someone (Kier, Bira or ... ?? ) put a final word about this contest and, WAITING the science-fiction VB v3.0, give us an upgraded and working version for 2.2.2 ?

I would expected such a prefix in this thread, but it seems absolutely forgotten by the authors, the moderators and everybody, just like the Cocomiel's version.
Both, as already said, aren't accurate and simply a cut&paste of v2.0.x code overwritten upon the not-compatible v2.2.x code.

Hope this will have finally an affirmative solution.
Thanks.

Jawelin
05 Feb 2002, 10:46
Originally posted by Cocomiel
The REAL working hack be found here (htp://www.vbulletin.org/forum/showthread.php?s=&threadid=28337)
No. Your version, along with this one, doesn't work on v2.2.x as it has copied code from 2.0.3 and pasten over 2.2.1 code without changing anything, even the underlying code is much different !

That should be the right end of a very uncomfortable story ?

Thnx

Kier
05 Feb 2002, 11:25
Oh this is getting tedious.

Give me 10 minutes and I will post some code that will work in the latest versions of vB, seeing as no one seems able to do it for themselves...

Jawelin
05 Feb 2002, 12:03
Originally posted by Kier
Oh this is getting tedious.

Give me 10 minutes and I will post some code that will work in the latest versions of vB, seeing as no one seems able to do it for themselves...
Thanks, Kier.
Much appreciated, even I dont agree with you.
I understand all these (two) threads are tedious and boring, but they gave a not-so-good light on hacker's professionality.
I would even able to make the corrections myself (as I did for similar hacks like store attachments as files by PPN in Beta section), but that thread is much different from this' tone level.
Here and on Cocomiel's one everything was said and all the opposite, without leading to anything different from a great and diffused confusion.

Actually is a very small problem, but do you think 167+70 replies shouldn't have completely discovered the theme ?

Thanks for you work, hwr.
Bye

Kier
05 Feb 2002, 14:12
A new and improved install script, together with new hacking instructions are attached to the first post in this thread.

Jawelin
05 Feb 2002, 15:19
Thank you so much!!!!
Hope this'll be a conclusive word.
I'll jump there!
Thnx

kontrabass
06 Feb 2002, 04:59
Regarding your 2.2.2 update:

I think there's an error under the /admin/user.php section - the first string of code to look for is listed twice with different instructions under each occurance:

// read file
$filesize=@filesize($filename);

TECK
06 Feb 2002, 10:35
Originally posted by Jawelin

No. Your version, along with this one, doesn't work on v2.2.x as it has copied code from 2.0.3 and pasten over 2.2.1 code without changing anything, even the underlying code is much different !

That should be the right end of a very uncomfortable story ?

Thnx hmmm... any mods can check the veridity and close cocomiel's thread? this is the worst part.. to steal someone else's hard work and stamp it as yours.

Kier
06 Feb 2002, 11:29
Originally posted by kontrabass
Regarding your 2.2.2 update:

I think there's an error under the /admin/user.php section - the first string of code to look for is listed twice with different instructions under each occurance:

// read file
$filesize=@filesize($filename); You're absolutely right... I've updated the readme file now, thanks :)

kontrabass
06 Feb 2002, 14:06
Sorry to be a pest, but I'm still seeing the discrepancy in the readme, under /admin/user.php with the same 2 instances of code.... :)

Kier
06 Feb 2002, 15:36
I'm not sure how you can have checked the new readme, as it's contained within the zip, and that shows only one download at this time, and that download was me...

Download it again, making sure you don't get a cached copy, and try again.

kontrabass
06 Feb 2002, 15:40
Thanks - I was getting a cached copy. All set now :)

mvigod
06 Feb 2002, 16:37
I've been watching this one for a long time...thanks for finally getting to the update on it!

marc

Jawelin
07 Feb 2002, 00:10
Originally posted by nakkid
hmmm... any mods can check the veridity and close cocomiel's thread? this is the worst part.. to steal someone else's hard work and stamp it as yours.
Actually Cocomiel, at later time, put on his first post something like 'UPDATE to Kier's hack'....
I think the most annoying theme was such a never-ending contest.
Very very grateful to Kier for his updated work, most of all for having stopped the sequel.
Thanks

TECK
07 Feb 2002, 02:26
Originally posted by Jawelin

Actually Cocomiel, at later time, put on his first post something like 'UPDATE to Kier's hack'....
I think the most annoying theme was such a never-ending contest.
Very very grateful to Kier for his updated work, most of all for having stopped the sequel.
Thanks thanks for clearing this out.. :)

kontrabass
07 Feb 2002, 14:54
One more thing: I think you should make a mention in the readme about how a custom_avatars directory needs to exist and have 777 permissions. Also that the .php script needs to be in /admin. I was able to find the instructions to do so in the old readme that someone attached to this thread, but not in the new.

Thanks for the hack - it's working great.

MaSTaKiLLaH
09 Feb 2002, 22:29
Where did you creat the custom_avatars directory ?
I made one in every sub-directory of my board an chmod them all 777, but it doesn't work

Do I have to upgrade to 2.2.2 ?

eva2000
10 Feb 2002, 21:54
Originally posted by Kier
A new and improved install script, together with new hacking instructions are attached to the first post in this thread. motivation for me to upgrade :D

thanks Kier :)

Kier
11 Feb 2002, 10:33
The custom_avatars folder needs to be created in same directory as the forumdisplay.php.

Instructions for this are in the install script, rather than the readme file.

Jawelin
13 Feb 2002, 10:20
Originally posted by Kier
The custom_avatars folder needs to be created in same directory as the forumdisplay.php.

Instructions for this are in the install script, rather than the readme file. Hi, Kier.
I successfully installed the hack, Great!

Just some question:
1) The avatardata in db (customavatar table) is filled the same. I guess the hack purpose is not to make a smaller db, but to unload the db itself when showing posts/threads giving a direct html link. Is it true ?

2) The filename in db (customavatar table) - the original filename - is not filled any more.... File is renamed ok, but if i would keep the original name as before ? Even, if i switched settings from file to db, again ?

3) Why the avatarrevision field is in user table and not in customavatar one ?

4) I tried to parametrize the directory name: infact I added in setting table a row with a setup instruction like this:$DB_site->query("INSERT INTO setting (settingid, settinggroupid, title,
varname, value, description, optioncode, displayorder) VALUES
('',26,'Custom Avatar File Directory', 'avatarpath', '/home/username/avatars/custom',
'The directory where custom avatars will be stored.', '', 10)");but realized that the directory name (unlike the PPN's attachment as files hack from which I took the tip) has to be a relative one, not absolute. Infact the same name is used the same time for http purposes and server side ones (copy/unlink/etc.). So that $avatarpath should be valued like 'images/avatars/custom' (without leading slashes) and simply replaced to your custom_avatars directory name.
Well. The problem is how to make read that global var to php's that don't import ./global.php... ?
I though to something like $avatarpath=trim($GLOBALS['avatarpath']); somewhere, but it seems not working...
I haven't any idea how to manage global settings... ;)

Thanks a lot for your attention.
Bye

Kier
13 Feb 2002, 17:12
1) The purpose of the hack is not to reduce the size of the database, but to dramatically reduce the number of queries required to display a page showing avatars.

It's much easier to simply show an image using the webserver than to have PHP query the database and grab the avatar from there.

2) Not sure about that... it should still store the filename

3) Because storing the avatar revision in the customavatar table would mean that the custom avatar table would still need to be queried = bad.

4) Um... not sure what you are trying to do here...

Jawelin
13 Feb 2002, 20:00
FoA, thanx for such a complete answer... :)

1) Agree! Will check better but seems is still a point in which avatar.php is accessed: userCP when updating avatar. I'll let you know if interested.

2) The filename isn't stored if the admin uploads a custom avatar for an user. Have no idea about the 'traditional' behavior of VB222 this case.

3) Elementar but right

4) In functions.php there's no global.php import, so the global variables aren't defined unless explicitly red. An assignment like mine just right before using the variable works fine (is the same way you read the usefileavatar global/setting var.

Thanks again.

Jawelin
13 Feb 2002, 22:22
Originally posted by Jawelin
FoA, thanx for such a complete answer... :)

1) Agree! Will check better but seems is still a point in which avatar.php is accessed: userCP when updating avatar. I'll let you know if interested.

[...]
1) I think was forgotten a hack point.
Infact, I understand that'll not affect performance purposes - the first goal of this
hack - but for a complete job, I think also the getavatarulr() function should be
modified, and become as follows:
// ###################### Start getavatarurl #######################
function getavatarurl($userid) {
global $DB_site,$session;

if ($avatarinfo=$DB_site->query_first("SELECT user.avatarid,user.avatarrevision,avatarpath,NOT ISNULL(avatardata) AS hascustom,customavatar.dateline
FROM user
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
WHERE user.userid='$userid'")) {
if ($avatarinfo[avatarpath]!="") {
return $avatarinfo[avatarpath];
} else if ($avatarinfo['hascustom']) {
$avatarpath=trim($GLOBALS['avatarpath']);
if ($GLOBALS['usefileavatar'] && $avatarpath>"") {
$avatarurl = "$avatarpath/avatar$userid"."_$avatarinfo[avatarrevision].gif";
} else {
$avatarurl = "avatar.php?userid=$userid&dateline=$avatarinfo[dateline]";
}
return $avatarurl;
} else {
return '';
}
}
}

(I would put in bold main differences from the original... but ... :( )

Of course, I put my 'version' with the $avatarpath global variable. Your original, it should be replaced with the stored directory name...

What do you think ?
Thnx.

Erwin
16 Feb 2002, 14:32
This is a revolutionary hack!

Thanks!!!

Erwin
17 Feb 2002, 11:29
It works fine. I even made it work with the memberlist avatar hack.

However, I was wondering if someone could give me some advice.

I still get avatars displayed using avatar.php rather than using the custom_avatar files with the following:

1) Avatar in a member's profile (member.php/ getinfo)
2) Avatar in the Welcome Panel
3) Avatar in the vBPortal logout panel

Any suggestions?

Erwin
17 Feb 2002, 11:39
Another note: Jawelin, your fix for the Welcome Panel and the User Profile does not help - avatar.php is still being used to display the avatars.

newvbuser
18 Feb 2002, 18:11
If I install this hack, what happens to the 20 or so users who are already using custom avatars and those are all stored in the dbase? Do I have to redo each of them? Thx !!

Jawelin
18 Feb 2002, 18:22
Originally posted by Erwin Loh
Another note: Jawelin, your fix for the Welcome Panel and the User Profile does not help - avatar.php is still being used to display the avatars. Mine isn't a 'fix', but a variation... as I used a parameter to setup the custom avatar directories.

If you always see the avatar.php? link instead of the image directly on the server, most probably your code doesn't enter the main if clause to that url.
Are all the settings correct ?

Erwin
18 Feb 2002, 19:13
I only see the avatar.php in the instances that I listed out. In all other cases (eg. in the postbit), I see the avatar on the server.

Jawelin
18 Feb 2002, 19:54
I think that was exactly the goal the author of this hack would reach: obtain a sensitive decrease of db queries to show avatars.

:)

Erwin
18 Feb 2002, 20:02
I understand. :)

Thanks! The goal was reached admirably by the talented author.

newvbuser
19 Feb 2002, 05:19
This hack creates mod to the database. When and if we upgrade to 3.x or something in between 2.2.2 and 3.x, would it affect the upgrade or would we hvae to manually drop the tables or it'll just ignore the extra tables? :confused:

newvbuser
19 Feb 2002, 06:09
Yes I installed this hack and it works great (PM's and messages show filed avatars). clicking on Profile still shows avatars via database so I'm not sure what'll happen when a new custom avatar is added.

My question is how to make sure the database will work with the new version when it is released? :)

Thanks kier for the great hack!

Wolf42
19 Feb 2002, 09:16
Thanks for this hack Kier, works perfectly! :D

X-Fan
21 Feb 2002, 05:29
Works great, Kier, thanks!!!!

I didn't see any mention in the readme of where to create the custom_avatars folder or that it had to be chmod set to 777, but managed to glean that from posts in the thread. Still, should be something included in the readme.

Just my 2c Australian, +GST ;)

Jawelin
22 Feb 2002, 16:22
Kier, excuse if I'm still here.... :greedy:
Well. As I often said, your hack v2.2.2 works very well....

But, alone... :china: I tried installing other hacks like welcome panel and generally those which use getavatarurl() function to retrieve the name...
As already said, I even tried to modify myself that function you seem having forgotten in readme.htm.
Also tried to use the Bira's upgrade to 2.2.1 (http://www.vbulletin.org/forum/showthread.php?postid=204453#post204453) some posts above.

But still I see some image holes linking :
http://forumurl/images/avatars/custom/avatar1_0.gif
if I have a standard forum avatar and not a custom one....
(I'm UserId=1 and, remember, I changed the default directory, but it's seen correctly and this isn't the problem)...

It means that somehow the above fuction doesn't recognize I have a standard avatar and not a custom one.... :confused:
Instead, in postbit and elsewhere (where the function isn't called), the right standard avatar is displayed linking to the image and not to the avatar.php? script, correctly as your hack makes it.

Are you planning to modify - also standing on all the above difficulties users found - that function too ?
Why not ???
:noid:

Thanks

Jawelin
28 Feb 2002, 13:48
*^ BUMP ^*
:pirate:

newvbuser
10 Mar 2002, 11:02
Has anyone used this hack with 2.2.3b vb?

atrl
10 Mar 2002, 20:56
I tried installing it but had some problems, But it may have just been me

atrl
11 Mar 2002, 03:01
Kier, Does this work with Vbulletin 2.2.4, cause I just installed 2.2.4 and I wanna know if it works on it?

MaSTaKiLLaH
24 Mar 2002, 09:23
I always get the errormessage from the error_avatarnotimage template.

Any idea ?

Erwin
24 Mar 2002, 09:59
Originally posted by atrl
Kier, Does this work with Vbulletin 2.2.4, cause I just installed 2.2.4 and I wanna know if it works on it?

Works fine with my forums using vB 2.2.4

Wayne2k1.com
27 Mar 2002, 14:23
BE AWARE

vBulletin 2.2.4 users

In both the first step of PHP editing (private.php and announcement.php and admin/functions.php) and the last one (/(admin/user.php) the last line is NOT:

} else

but

} else {

Just a warning :D

newvbuser
15 Apr 2002, 06:22
Hey is this hack causing any probs with generating email lists, or mass emailing group functions?

Mass emailing does notwork for me but the only major hack I have is this hack and nothing else so I am a bit worried as to why mass email is not working :(

Jawelin
25 Apr 2002, 12:10
Hi. I've been using this hack for months without any problem, even mixing with other avatar-related ones...

Suddendly, some days ago, I noticed some mis-function with the custom avatar upload by an user.
Infact, with vb2.2.5, I noticed which follows:[list=1]
Avatarrevision field in user table isn't incremented (it lasts 0)
Row in customavatar table is correctly added
New image file (avatarXX_R.gif/jpg) isn't copied into custom avatar directory
The new avatar is correctly displayed near the username everywhere [ getavatarurl() function ], but the url of the image isn't a file but avatar.php?userid=xx&dateline=1019732362 ... This means the hack isn't effective this case.
Old uploaded avatars with files in custom directory (and the correct avatarrevision value in the user table) still work correctly. The url of file is actually linked.
[/list=1] --- > I think the problem is in member.php but I double-checked your instructions and didn't found any mistake...

Could you help me ?

Thank you very much
Bye

P.S.: custom avatars are ALWAYS stored into directory as .gif files, both gif and jpg types. Reason is obvious, but could it be a (another than above described one) problem to browser to correctly decode the img format when displaying it ?
Thanks again.

Colon33
05 Jun 2002, 01:11
Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/forums.gamer-pit.com/httpdocs/admin/user.php on line 706


I keep getting this whenever i try uploading an avatar or linking one. The image appears broken with the URL pointning to avatar.php rather than the file itself. All directories are CHMOD'd to 777

KuraFire
09 Jun 2002, 22:57
so, like, this hack doesn't work well on vB 2.2.5 ?

:(

Dean C
17 Sep 2002, 17:37
anyone have this working on a 2.2.6???

Thanks in Advance

- miSt

Raizor
21 Sep 2002, 19:58
I am using this on 2.2.6 and the only issue that I have is that after a database restore, the avatar links are all broken. The only way to get them back is to re-apply the links again in every account that had a custom avatar.

I was wondering if there is a way to store the links in the database so that a restore would keep the custom avatars functioning properly.

Smoothie
21 Sep 2002, 22:35
Have it working on 2.2.7

exTracT
17 Oct 2002, 11:19
anyone have this working with 2.28? was there anything noted to set it up? I want to protect my avatars from cross linking

Tim Wheatley
18 Oct 2002, 15:11
Hm... My host says this will make masses of difference with the server. I already have attachments as files installed. I have 2.2.7 (heavily hacked) installed. I see someone has this working... I'll give it a shot!

Tim Wheatley
19 Oct 2002, 01:27
Works perfect for uploading and storage thusfar. vb2.2.7.

Will keep you informed.

Okiewan
19 Oct 2002, 16:59
Version 2.2.8 ... seems that the member.php has changed, as the code is not the same as in the readme file. Any tips on where to insert the code?


// read file
$filesize=@filesize($filename);
if ($filesize>$avatarmaxsize) {
eval("standarderror(\"".gettemplate("error_avatartoobig")."\");");
// file size too big
exit;
}

ladyfyre
22 Oct 2002, 03:57
I am running 2.2.8 as well, and the block of code you are looking for is still there, just slightly changed....

look for:

// read file
$filesize=@filesize($filename);
if ($filesize>$avatarmaxsize) {
@unlink($filename);
eval("standarderror(\"".gettemplate("error_avatartoobig")."\");");
}

Brew
03 Nov 2002, 20:29
One of the things I noticed about this hack is that it doesn't delete images when a user has been deleted in the admin area.

Anyone have any ideas on how to get the image deleted when the users have been pruned/deleted?

Brew

spazeman
25 Nov 2002, 08:44
Originally posted by Brew
One of the things I noticed about this hack is that it doesn't delete images when a user has been deleted in the admin area.

Anyone have any ideas on how to get the image deleted when the users have been pruned/deleted?

Brew

yes good question. i really want to install this hack but i need to be able to easily delete the avatar images when i nuke a user.

catbaba
25 Jan 2003, 17:30
FYI, I have this hack working on vB 2.2.9.

It's super!

X-Fan
20 Mar 2003, 05:41
I recently upgraded to vB 2.3.0 and re-applied this hack but it's not working. Keep getting "No avatar specified. If you followed a valid link, please notify the webmaster" errors.

Can someone help?

Cyclonus
22 Apr 2003, 13:51
I've got this working in vB 2.3.0, but a couple of questions, if anyone knows.

1. How do you make it compatible with the Welcome Panel hack? Everything I tried, it doesn't pull up the URL to the avatar file correctly (doesn't add user ID to it).

2. My users get an error whenever they upload a custom avatar:

[function.copy]: failed to create stream

It does allow the upload to complete & picks up the new avatar, so it's no big deal, I was just wondering...

Koutaru
29 Apr 2003, 01:03
=/ yes working with the welcomepanel would greatly help

gmarik
24 May 2003, 13:34
04-29-03 at 04:03 AM Koutaru said this in Post #225 (http://www.vbulletin.org/forum/showthread.php?postid=388689#post388689)
=/ yes working with the welcomepanel would greatly help

Indeed. :chinese:

Courage
24 May 2003, 14:35
I have 2.3.0 and is working with the wellcome panel hack.

Indeed the avatar is not haken from the file, but from Mysql on the forum home...
I also have improuved avatar settings hack :)

Thomas P
27 Sep 2003, 12:53
Any issues about this hack and 2.3.2?

Is it working with the Welcome Panel hack (not sure) and what do I have to obey?

thx,
-Tom

forumdude
22 Sep 2004, 01:29
Please add the ability to this hack to import the avatars back into the db so that it can be upgraded to vb3.