PDA

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


Kier
03-18-2001, 10:00 PM
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.

03-18-2001, 11:04 PM
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 ?

03-18-2001, 11:06 PM
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 ) ?

03-18-2001, 11:08 PM
Kier, you know what ? :)
It would be GREAT to port this system to attached files to :)

03-18-2001, 11:12 PM
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.

03-18-2001, 11:22 PM
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 ?

03-18-2001, 11:26 PM
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

03-18-2001, 11:29 PM
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.

03-18-2001, 11:32 PM
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 ?

03-18-2001, 11:35 PM
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.

03-18-2001, 11:41 PM
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.

03-19-2001, 12:14 AM
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 :)

03-19-2001, 12:23 AM
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'

03-19-2001, 12:40 AM
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. :)

03-19-2001, 09:22 AM
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".

03-19-2001, 09:26 AM
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

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

03-19-2001, 11:34 AM
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.

03-19-2001, 01:58 PM
kool hack Kier

03-19-2001, 03:18 PM
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.

03-19-2001, 04:16 PM
They are just RENAMED to GIFs or are they converted to GIFs?

03-19-2001, 04:21 PM
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.

03-19-2001, 04:22 PM
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')

03-19-2001, 04:25 PM
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.

03-19-2001, 04:45 PM
You're right. I'll look into it.

03-19-2001, 04:51 PM
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.

03-19-2001, 05:44 PM
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.

03-19-2001, 05:55 PM
Thank you Kier!

03-19-2001, 06:14 PM
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) ;)

03-19-2001, 06:34 PM
Another great hack Kier!
Thanks a lot

03-19-2001, 07:19 PM
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.

03-19-2001, 07:32 PM
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.

03-19-2001, 07:55 PM
one more kier
you are the best of the best!

03-19-2001, 09:15 PM
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.

03-19-2001, 10:16 PM
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:

03-20-2001, 02:15 AM
<< removed >>

03-20-2001, 02:58 AM
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!

03-30-2001, 03:55 PM
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!

03-30-2001, 07:51 PM
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. :)

03-30-2001, 07:59 PM
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
04-10-2001, 05:32 AM
This might be a silly question (sorry!), but why isn't this a part of the official product?

TechTalk
04-12-2001, 02:23 AM
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
04-12-2001, 02:40 AM
It will be part of 2.1

jojo85
04-12-2001, 03:49 AM
Nice :D

VirtueTech
04-14-2001, 08:40 AM
Thank you very much Kier

TooHectic
04-15-2001, 02:58 AM
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
04-15-2001, 03:03 AM
I proceeded and it worked great with beta 5

TooHectic
04-15-2001, 07:20 AM
Thanks... I'll try it tomorrow.

CityNet
04-16-2001, 07:36 AM
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
04-16-2001, 01:05 PM
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
04-16-2001, 05:59 PM
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
04-19-2001, 10:15 PM
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
05-10-2001, 11:05 PM
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
05-11-2001, 08:33 PM
anyone?

eiko
05-12-2001, 01:25 PM
Maybe I asked this question in the wrong forum?

eiko
05-12-2001, 01:47 PM
Well no wonder no one replied...
Sorry... BONEHEAD mistake on my part.

uhh...

in my best Gilda Radner.... Nevermind.

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

TGO
05-17-2001, 11:22 PM
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
05-20-2001, 01:51 AM
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
05-20-2001, 10:53 AM
I'm in the same boat as TGO the hack is needed badly too, any help would be greatly apriciated.

Sven
05-22-2001, 08:11 AM
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
05-22-2001, 09:52 AM
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
05-22-2001, 06:17 PM
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
05-23-2001, 01:32 AM
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
05-23-2001, 06:20 PM
Hey PeterS, cool site! where did you get that cool news fader?

Luciano
05-24-2001, 06:57 AM
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
05-25-2001, 10:01 AM
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
05-25-2001, 09:05 PM
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
05-25-2001, 11:25 PM
Ditto...I would like to install it into V2.0 final.

eva2000
05-25-2001, 11:27 PM
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
05-26-2001, 12:45 AM
What does Read to re-tweak mean?

jucs
05-27-2001, 12:46 PM
Answer Sven and my questions? Thanks.

Sven
05-27-2001, 02:13 PM
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
05-27-2001, 02:59 PM
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
05-27-2001, 03:01 PM
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
05-28-2001, 05:10 AM
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
05-28-2001, 03:26 PM
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
05-28-2001, 03:31 PM
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
05-28-2001, 03:46 PM
I just started with that file...are there any more of these discrepencies?

Sven
05-28-2001, 06:45 PM
@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
05-28-2001, 10:59 PM
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
05-29-2001, 08:01 PM
Can someone update the hack install documentation so that 2.0 gold users will know exactly what to do? Thanks.

Sven
05-30-2001, 06:47 AM
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
05-30-2001, 04:29 PM
hey, may be the guy is busy.:o

rebby
05-31-2001, 06:05 PM
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-05-2001, 10:11 PM
updating the Instructions woukd be very nice.

Tnx

TooFastForYa
06-06-2001, 03:12 AM
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-06-2001, 04:36 PM
I would just go for getting the documenation updated. :(

Dakota
06-07-2001, 03:22 AM
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
06-09-2001, 06:44 AM
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
06-10-2001, 07:44 PM
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
06-15-2001, 07:19 PM
Please anyone ?????? :(

Tolitz
06-23-2001, 07:20 AM
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
06-23-2001, 02:12 PM
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
06-23-2001, 02:34 PM
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
06-26-2001, 09:52 AM
When the hack is installed and all files are stores in the folder, is it safe to empty the custom_avatar table then?

Dimitri
06-29-2001, 10:25 PM
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
07-02-2001, 07:00 PM
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
07-16-2001, 06:39 AM
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
07-16-2001, 10:02 AM
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
07-25-2001, 08:23 AM
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
07-29-2001, 07:38 PM
Bump. Come on, no one?

VirtueTech
07-30-2001, 04:15 AM
Doesn't 2.0.1 include this hack already?

Same with attachments?

Scoty
07-31-2001, 04:01 AM
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
08-07-2001, 07:50 AM
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
08-07-2001, 08:36 AM
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
08-07-2001, 11:32 AM
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
08-07-2001, 12:26 PM
yea i just noticed that so you just have to hack the showthread file up.

eXtremeTim
08-07-2001, 12:47 PM
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
08-10-2001, 12:07 AM
Any progress in getting this to work properly for 2.0.3 showthread?

HalfBreed
08-12-2001, 07:00 PM
**BUMP**

Dakota
08-17-2001, 06:14 AM
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
08-17-2001, 06:51 PM
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
08-23-2001, 05:07 PM
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
08-24-2001, 11:39 PM
Keir, buddy. Please rerelease an update for your hack!!! It is needed.

dost
08-25-2001, 01:41 AM
Yes please I also want to use this hack with vB 2.0.3

centris
08-25-2001, 03:09 PM
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
08-29-2001, 04:54 PM
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
09-04-2001, 01:14 PM
Any news yet ? My forum needs this mod to work!
thanks for your great feature

pier

tamarian
09-04-2001, 11:05 PM
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
09-05-2001, 12:01 AM
Unless this hack is done, none of my members can change their avatars :-/

Sven
09-06-2001, 09:07 PM
^bump^this^a^little^ ;)

DarkReaper
09-06-2001, 09:47 PM
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
09-06-2001, 09:51 PM
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
09-06-2001, 10:09 PM
Thanks :)

kaeros
09-07-2001, 03:22 PM
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
09-15-2001, 06:15 PM
This hack needs to be updated for 2.0.3 ! ! !

Cocomiel
09-15-2001, 08:11 PM
Please Update the hack ... why you didnt yet ?
Its one of the bests hacks outhere

Cocomiel
09-15-2001, 08:12 PM
Ok, i will code this one, will be ready in two days

DarkReaper
09-15-2001, 09:56 PM
um..the installation link isn't loading.

dost
09-21-2001, 02:44 PM
two days passed :P how is it going?

Cocomiel
09-21-2001, 05:50 PM
you should look here :


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

DarkReaper
11-02-2001, 02:28 AM
How can I get this to work with 2.2.0?

psico
11-03-2001, 09:33 AM
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
11-03-2001, 02:38 PM
This hack was for 2.0, i dont have idea why they put 2.2.0

eva2000
11-03-2001, 02:42 PM
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
11-15-2001, 05:19 PM
Is this supported on vBulletin 2.2.0? I see different code than what is in the instructions for the function.php file.

ladyfyre
11-30-2001, 02:49 AM
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
12-02-2001, 10:41 PM
What about 2.2.1?

bira
12-03-2001, 12:03 AM
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
12-03-2001, 03:10 AM
thanks Bira :D

Dark Blaze
12-05-2001, 06:31 PM
Great Hack Kier, congrats :)

Dark Blaze
12-05-2001, 06:32 PM
Also, thanks Bira for making this hack available for 2.2.1 version forums :)

SirSteve
12-05-2001, 06:47 PM
What happens to the current custom avatars my members are using if I install this hack?

bira
12-05-2001, 09:56 PM
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
12-05-2001, 10:25 PM
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
12-05-2001, 10:30 PM
DarkReaper, I think that's what I did some 6 or so posts up :D

SirSteve
12-05-2001, 10:34 PM
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
12-05-2001, 10:38 PM
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
12-15-2001, 01:42 PM
Does this hack work in 2.0.3? ;)

Gutspiller
12-15-2001, 02:30 PM
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
12-15-2001, 05:33 PM
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
12-24-2001, 12:51 AM
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
12-24-2001, 05:21 AM
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
12-26-2001, 12:19 PM
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
01-11-2002, 04:06 PM
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
01-14-2002, 10:14 AM
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
01-15-2002, 11:53 AM
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
01-15-2002, 02:06 PM
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
01-23-2002, 03:45 AM
^ bump

Cocomiel
01-23-2002, 04:05 AM
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
01-23-2002, 04:20 AM
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
01-25-2002, 04:42 PM
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
01-27-2002, 11:59 AM
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 (https://vborg.vbsupport.ru/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
02-05-2002, 08:37 AM
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
02-05-2002, 08:46 AM
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
02-05-2002, 09:25 AM
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
02-05-2002, 10:03 AM
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
02-05-2002, 12:12 PM
A new and improved install script, together with new hacking instructions are attached to the first post in this thread.

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

kontrabass
02-06-2002, 02:59 AM
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
02-06-2002, 08:35 AM
[QUOTE]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

Kier
02-06-2002, 09:29 AM
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
02-06-2002, 12:06 PM
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
02-06-2002, 01:36 PM
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
02-06-2002, 01:40 PM
Thanks - I was getting a cached copy. All set now :)

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

marc

Jawelin
02-06-2002, 10:10 PM
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
02-07-2002, 12:26 AM
[QUOTE]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

kontrabass
02-07-2002, 12:54 PM
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
02-09-2002, 08:29 PM
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
02-10-2002, 07:54 PM
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
02-11-2002, 08:33 AM
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
02-13-2002, 08:20 AM
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
02-13-2002, 03:12 PM
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
02-13-2002, 06:00 PM
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
02-13-2002, 08:22 PM
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
02-16-2002, 12:32 PM
This is a revolutionary hack!

Thanks!!!

Erwin
02-17-2002, 09:29 AM
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
02-17-2002, 09:39 AM
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
02-18-2002, 04:11 PM
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
02-18-2002, 04:22 PM
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
02-18-2002, 05:13 PM
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
02-18-2002, 05:54 PM
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
02-18-2002, 06:02 PM
I understand. :)

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

newvbuser
02-19-2002, 03:19 AM
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
02-19-2002, 04:09 AM
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
02-19-2002, 07:16 AM
Thanks for this hack Kier, works perfectly! :D

X-Fan
02-21-2002, 03:29 AM
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
02-22-2002, 02:22 PM
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 (https://vborg.vbsupport.ru/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
02-28-2002, 11:48 AM
*^ BUMP ^*
:pirate:

newvbuser
03-10-2002, 09:02 AM
Has anyone used this hack with 2.2.3b vb?

atrl
03-10-2002, 06:56 PM
I tried installing it but had some problems, But it may have just been me

atrl
03-11-2002, 01:01 AM
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
03-24-2002, 07:23 AM
I always get the errormessage from the error_avatarnotimage template.

Any idea ?

Erwin
03-24-2002, 07:59 AM
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
03-27-2002, 12:23 PM
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
04-15-2002, 04:22 AM
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
04-25-2002, 10:10 AM
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
06-04-2002, 11:11 PM
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
06-09-2002, 08:57 PM
so, like, this hack doesn't work well on vB 2.2.5 ?

:(

Dean C
09-17-2002, 03:37 PM
anyone have this working on a 2.2.6???

Thanks in Advance

- miSt

Raizor
09-21-2002, 05:58 PM
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
09-21-2002, 08:35 PM
Have it working on 2.2.7

exTracT
10-17-2002, 09:19 AM
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
10-18-2002, 01:11 PM
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
10-18-2002, 11:27 PM
Works perfect for uploading and storage thusfar. vb2.2.7.

Will keep you informed.

Okiewan
10-19-2002, 02:59 PM
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
10-22-2002, 01:57 AM
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
11-03-2002, 06:29 PM
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
11-25-2002, 06:44 AM
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
01-25-2003, 03:30 PM
FYI, I have this hack working on vB 2.2.9.

It's super!

X-Fan
03-20-2003, 03:41 AM
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
04-22-2003, 11:51 AM
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
04-28-2003, 11:03 PM
=/ yes working with the welcomepanel would greatly help

gmarik
05-24-2003, 11:34 AM
04-29-03 at 04:03 AM Koutaru said this in Post #225 (https://vborg.vbsupport.ru/showthread.php?postid=388689#post388689)
=/ yes working with the welcomepanel would greatly help

Indeed. :chinese:

Courage
05-24-2003, 12:35 PM
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
09-27-2003, 10:53 AM
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
09-21-2004, 11:29 PM
Please add the ability to this hack to import the avatars back into the db so that it can be upgraded to vb3.