PDA

View Full Version : Custom Avatars as Files


Cocomiel
18 Sep 2001, 08:12
Custom Avatars As Files Hack for VB 2.2.1
BASED ON THE KIER'S HACK

Description: This hack lets you store custom avatars in a separate folder rather than in the VBulletin database, saving space & querys in your MySQL database

Here are some of the features:


Allows to switch between file mode & database mode on the fly

You can specify the custom avatar folder

No SQL queries or PHP code required to display custom avatars

If you use the Apache Web Server, the avatars folder can be protected by .htaccess thus preventing bandwidth stealing

No cacheing issues with Internet Explorer 5.5

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.


Intructions:
Upload install_fileavatar.php to your ADMIN directory and open it in your browser, then follow the screen instructions.

TheFox
18 Sep 2001, 23:24
EXCELLENT HACK !!! :D :D :D

WORKS GREAT!

THANKS MAN :cool:

grumpy
19 Sep 2001, 10:59
There seems to have been a slight problem with the database, etc etc

I backed it up first and then started from scratch, still got the same error.

I admit I don't know anything about php, but I'm curious about the coding in the instructions. For example, you say to find:
if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
and replace with:

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


As I say, I don't know PHP, but every instance I've seen of else is enclosed as } else {, but not in your script. Could this cause the error?

thanks :)

grumpy
19 Sep 2001, 11:15
Ah, received my tech error email, it shows:

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

:confused:

TheFox
19 Sep 2001, 16:23
Grumpy:

if - else statements are not necessary enclosed by '}{'

I recommend you start from the original VB version ( unhacked ), and follow the instructions carefully.

Cocomiel
19 Sep 2001, 16:30
The second error you get is because you have the hack already installed, i will add code handle this in the next release.

If someone else is getting that error please tell.
Thanks, Cocomiel

grumpy
19 Sep 2001, 17:28
Not sure if this will help, but the error I posted from the tech email was from the first attempt.


thanks for your help :)

Cocomiel
19 Sep 2001, 17:40
Ok, that explains everything.

The error appears because you already have an avatarrevision field in your database, that is because you already instaled another hack that added that field.

if you have phpMyAdmin instaled, select to your database
and in the USER table delete the 'avatarrevision' field

then go to the SETTINGS table and delete the last two fields

But, as previously was mentioned I suggest you to begin installing the hack with a clean VB.

xtrim
20 Sep 2001, 13:48
Hi,

Great work on this hack cocomiel.

I have not get into this or installed yet, but I was wandering if this hack could be made compatible or is already compatible with the avatar categories hack posted.

I dunno if its got anything to do with the code involved but I would like to know if both hacks could be installed to work together.

Thank you.

Cocomiel
20 Sep 2001, 16:29
Xtrim, I dont know anything about that hack, but i will try to make it compatible in the next release

Cocomiel
20 Sep 2001, 17:49
I've looked into the installation.txt of that hack and since it only applies to avatars uploaded by the admin should work with my hack without problems.

DarkReaper
20 Sep 2001, 19:23
Installation took about 20 minutes(I forgot to download the files from the server, so I was using old versions - different comp:)) and it worked perfectly.

Thanks! :)

Nupraptor
21 Sep 2001, 22:34
Would other hacks interfere with this one? I want to know before I install it.

Cocomiel
21 Sep 2001, 22:43
As long as i know it will no interfere with any other hacks.

Nupraptor
21 Sep 2001, 22:48
Ok. :) Just asking because I saw this statement:I recommend you start from the original VB version ( unhacked ), and follow the instructions carefully.Also, is the step involving the "chmod" vital? Because I can't do that for the time being.

Cocomiel
21 Sep 2001, 23:00
Well, i made that recommendation because normally when you can't install a hack is because the lines you must find in the code are changed or do not exist product of a previous installed hack.

Was just a recomendation, and applies to any hack, not specially this.

The chmod step is necessary if you want to create a new folder to store the custom avatars, if you already have one you want to use dont need to do so. Just type the path in the installation and it will work

Note: The path should not include previous or final backslashes

for example if you want to use the '/images/avatars/' folder
you should type images/avatars in the path

Hope that helps. :)

Nupraptor
21 Sep 2001, 23:11
Perfect, thanks. :)

Neo
25 Sep 2001, 19:57
i get this error ehat should i do?

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
Date: Tuesday 25th of September 2001 01:54:18 PM
Script: /admin/install_fileavatar.php?action=Install&path=custom_avatars+
Referer: http://ww..com/admin/install_fileavatar.php?action=Confirm&path=custom_avatars+

kchii
29 Sep 2001, 14:46
Originally posted by cocomiel
then go to the SETTINGS table and delete the last two fields

But, as previously was mentioned I suggest you to begin installing the hack with a clean VB.

Ok, I deleted the 2 tables, Optioncode and Displayoder as above. I also made sure Avatarrevision was deleted. The install script recreates Avatarrevision, but gives this error:


Database error in vBulletin Control Panel: Invalid SQL: INSERT INTO setting
(settingid, settinggroupid, title, varname, value, description, optioncode, displayorder)
VALUES
('', '26', 'Store Custom Avatars as Files?', 'usefileavatar', '0', 'Would you like to store your avatars in the database, or as static files in a directory?', 'yesno', '9')
mysql error: Unknown column 'optioncode' in 'field list'
mysql error number: 1054
Date: Saturday 29th of September 2001 08:43:10 AM
Script: /admin/install_fileavatar.php?action=Install&path=images%2Fcustom&s=
Referer: http://www.animegathering.com/admin/install_fileavatar.php?action=Confirm&s=&path=images%2Fcustom


Can someone help? I have the Avatars as Categories hack installed.

maverick1236
29 Sep 2001, 19:41
It works perfect-thanks!!

could you possibly help me with the photo upload hack?

that hack WILL NOT let me upload anything-yet your hack DOES!!!

i would REALLY appreciate it...

Again-tx 4 a great hack

Justice
10 Oct 2001, 13:56
cocomiel, since this system is file-based, is there any way to allow members to use hot linked images for custom avatars? This would be a great feature, giving members more freedom and saving the host bandwidith.

So far, the only way I can think of using this would be to add an extra profile field for avatars, and add the image url in postbits. But that would require me to turn off the other avatars all together, losing all of the features and options that come with the system. :(

Any ideas?

SweClockers.com
12 Oct 2001, 11:38
I have installed the hack, but i have some trouble with it. The installationscript worked great etc, and users avatars are showing. But, when I want to change my avatar in 'my profile' or add one i just recieve a blank page :\. I tried to upload the 2.0.3 orginal files on to the server but still the same thing happens.

The forum is at http://www.sweclockers.com/forum

Could you please help me?


Edit: I found the error, It was not because of this hack. My members.php had been modified ealier and when upgrading to v2.0.3 it stopped working.

Cocomiel
12 Oct 2001, 13:38
Originally posted by Justice
cocomiel, since this system is file-based, is there any way to allow members to use hot linked images for custom avatars? This would be a great feature, giving members more freedom and saving the host bandwidith.

So far, the only way I can think of using this would be to add an extra profile field for avatars, and add the image url in postbits. But that would require me to turn off the other avatars all together, losing all of the features and options that come with the system. :(

Any ideas?

Ok, i will add that feature as part of my hack in the next release. It will be ready in 1 week.

Justice
12 Oct 2001, 15:58
thanks

dost
28 Oct 2001, 17:06
Does it check for the maximum dimensions of the avatar when using this hack? Because I installed it and set the max. dimensions to be 65 and someone used an image with 173x200 but it was smaller than the max. file size.

Thanks

dost
29 Oct 2001, 08:19
I tried it on my computer and it works. So the problem is with my host. I also can't change others' avatars via the Admin CP in my host. It says changed but it doesn't. It's an unix machine with apache and plesk software installed. What can cause this problem? Bad permissions or what?

Any help will be greatly appreciated.

Thanks

Justice
30 Oct 2001, 05:10
I got the same error as grumpy, and followed your directions here...

Originally posted by cocomiel
if you have phpMyAdmin instaled, select to your database
and in the USER table delete the 'avatarrevision' field

then go to the SETTINGS table and delete the last two fields


Now the options in my CP don't load, and I get this error:

Database error in vBulletin Control Panel: Invalid SQL: SELECT settingid,title,varname,value,description,optioncode,displayorder FROM setting WHERE settinggroupid=1 ORDER BY displayorder
mysql error: Unknown column 'optioncode' in 'field list'
mysql error number: 1054

I've been to some threads on my board, and the hack actually seems to work. But I just can't seem to log into my CP. I think I need to add two fields or rows back into my Settings table. I should have backed up, I know... but my forum isn't live yet, so I'm just testing.

Cocomiel
03 Nov 2001, 15:49
Thats because you deleted the wrong fields

Cocomiel
03 Nov 2001, 15:51
I will release Custom Avatars As Files for 2.2.0 in a moment, DONT download Kier's hack because it will not work, its for 2.0.0

Frank-kun
08 Nov 2001, 05:29
Hey, good to see VB.org back and running...

I was looking for the attachment for this great hack that I'm currently using, but it appears to have been edited out. Does Cocomiel or anyone have the hack file or at least offer up some insight on why it was taken down? ^_^

CrazyJohn
12 Nov 2001, 20:58
I, too, need this hack, but can't find the attachment...help!

DarkReaper
12 Nov 2001, 22:01
Attachment go bye bye :confused:

MikeWarner
15 Nov 2001, 17:21
ditto:(

ladyfyre
01 Dec 2001, 17:39
I would also be VERY interested in downloading this hack if it can be made available again.

Also, I would like to know if it is compatible with 2.2.1??

atrl
01 Dec 2001, 20:07
YES PLEASE DO THIS :D
Everyone will be happy!!!!

MikeWarner
02 Dec 2001, 18:40
Am I the only one having problems with this download?

atrl
02 Dec 2001, 19:06
It downloaded fine for me :D

bira
02 Dec 2001, 19:12
What is the difference to Kier's excellet Custom Avatars as Files (http://www.vbulletin.org/forum/showthread.php?s=&threadid=11760) hack? :confused:

atrl
02 Dec 2001, 19:27
../member.php not modified ( chmod 777 this file and try again ).
Warning: fopen("../private.php","w") - Permission denied in *MYPATH*/admin/install_fileavatar.php on line 15

I chmod the file to 777 and hit reload and it doesnt work what should i do?

ladyfyre
02 Dec 2001, 20:33
nope...i am too. downloaded the file, but got gibberish instead :(

atrl
02 Dec 2001, 23:13
Umm how do i fix that error Cocomiel

Cocomiel
02 Dec 2001, 23:20
Please read the instructions, on Unix Systems you must chmod 777 the files, if the script says file xxx not modified maybe is because the file is already modified so you dont need to run it again. If you continue having problemas please post your php version/server platform etc

ladyfyre
03 Dec 2001, 01:44
Ok....so maybe i am just dense here...but:

when i click the link to download install_fileavatar.php, it instead gives me a file called "attachment.php", which is an unreadable file. am i doing something wrong here?

Cocomiel
03 Dec 2001, 01:55
Originally posted by ladyfyre
Ok....so maybe i am just dense here...but:

when i click the link to download install_fileavatar.php, it instead gives me a file called "attachment.php", which is an unreadable file. am i doing something wrong here?

In Fact, its unreadable. but can be executed anyway.
Its a compiled PHP file.

derfelix
03 Dec 2001, 20:49
well i dont want to complicate things.. but when i execute the php file i get:
Parse error: parse error in c:\apache\htdocs\install\install_fileavatar.php on line 13

wouldn't it be much easier to post the code...???
anyway if it integrates in vbull, it will open up.. or not???

Streicher
15 Dec 2001, 17:25
What happens with the custom avatar of a user, when I delete the user? Is the avatar file also removed?

lonely
25 Dec 2001, 09:10
This hack worked beautifully!

Thank you so much!!

Cocomiel
25 Dec 2001, 19:06
;)

bira
25 Dec 2001, 20:28
Cocomiel you haven't answered my question.

How is this hack different to Kier's hack? Why is there a need for a second hack if one already exists?

Cocomiel
25 Dec 2001, 21:03
Bira, don't hesitate me, Kier's hack was for 2.0.0 or previous. Mine is for 2.2.1 and has different features ok ?
Although you and vb.org try to fool people putting 2.2.1 on the kier hack post (pumping the thread also) and later posting instructions with code from my hack trying to make it work with the newest versions of the VB

Please stop fooling people.

As consecuence of actitudes like yours, I have no posted all the other hacks i wrote for my VB. And im sure other people is doing the same.

bira
25 Dec 2001, 21:35
Cocomiel, I don't understand your English I'm afraid.

I ask you a very simple question. You ignored it the first time, and now you attack me the second time.

I asked you what is different in your hack from Kier's hack.

If it's the same and you simply updated it for 2.2.1 (which, by the way, the original hack works fine on 2.2.1 as well) - then at the very least you should have given credit to Kier.

If it's different, then please tell us how. It will give people the option to know that this one has other features and they can choose.

Either way, don't be rude. I am trying to help here -- there's no point in people posting duplicate hacks of hacks that already exist, or we'd all be losing from it.

mvigod
23 Jan 2002, 22:03
Originally posted by Cocomiel
For those who dont want to use the installer.

Don't understand...at the top of this install.txt file it says"



RUN INSTALL SCRIPT : Upload install_fileavatar.php to your ADMIN directory and open it in your browser.


I thought this was for those who don't want to use the installer? What am I missing here? Also, I don't like running any installer which modifies the database unless I can see the code to see what it's doing. If something does go wrong with the database I have no way of knowing what the installer could have done to cause it since the source code is hidden.

I also don't want to have to recompile my php to use the zend optimizer as I'm using APC cache and the compatibility is unknown plus you get better speed from APC then you will from the Zend Optimizer.

Looks like a great hack and really would like to try it out though. Any chance of posting it not encoded?

Marc

Kier
24 Jan 2002, 05:14
Hmm... looks familiar :?:

Anyway, the reason why my Avatars as Files hack hasn't been updated is that a modified version of it is now in vBulletin 3.

Cocomiel
24 Jan 2002, 05:48
Good !
so, when it will be ready :rolleyes: ?

Kier
24 Jan 2002, 05:57
When it's finished. :rolleyes:

Cocomiel
24 Jan 2002, 06:14
Ok, so people still needs the avatars as files hack.

Added a mention to your hack here (http://www.vbulletin.org/forum/showthread.php?s=&threadid=28337)

Can you send me a PM with the aprox. release date ? :D

Please

Kier
24 Jan 2002, 06:18
No need for a PM. vBulletin 3 is still several months away. There are far too many cool things to put into it yet.

Cocomiel
24 Jan 2002, 06:24
Also, i found VB 2.2.1 vulnerable to a DoS attack, but im not sure if its a mySQL or PHP/Apache Issue, i've tested it on several configurations and it was vulnerable in every one!

I think i should post this on vb.com bugs forums, or maybe you are already alerted about this?

I will delete this posts if you want

Kier
24 Jan 2002, 07:54
Go ahead and email me if you think it's a vBulletin issue.

Cocomiel
24 Jan 2002, 10:32
Updated first post, download it again

Originally posted by mvigod


Don't understand...at the top of this install.txt file it says"



RUN INSTALL SCRIPT : Upload install_fileavatar.php to your ADMIN directory and open it in your browser.


I thought this was for those who don't want to use the installer? What am I missing here? Also, I don't like running any installer which modifies the database unless I can see the code to see what it's doing. If something does go wrong with the database I have no way of knowing what the installer could have done to cause it since the source code is hidden.

I also don't want to have to recompile my php to use the zend optimizer as I'm using APC cache and the compatibility is unknown plus you get better speed from APC then you will from the Zend Optimizer.

Looks like a great hack and really would like to try it out though. Any chance of posting it not encoded?

Marc

mvigod
24 Jan 2002, 14:02
Cocomiel,

Thanks for the reupload and prompt reply....code looks good and looking forward to installing it!

Great job by the way!

marc

Jawelin
25 Jan 2002, 17:43
As I have a very hacked 2.2.1 board, the installer is able to modify only 2 files.
It could be possible to have a txt procedure ?

Thanks a lot

Cocomiel
25 Jan 2002, 18:28
If the installer is unable to modify the files, please edit the files manually following the attached instructions

Jawelin
25 Jan 2002, 18:51
Thanks a lot.
Very appreciated such a fast and solving answer.

I'll do it by hand asap.
Bye

Jawelin
27 Jan 2002, 11:27
Sorry, but I think your .txt procedure just attached is old or inaccurate. :dead:

For instance, the replacement if ($usefileavatar) $avatarurl="images/avatars/custom/avatar$post[userid]_$post[avatarrevision].gif"; is absolutely a static link much different from the one explained many posts above here.

:confused:
How could it work in 'abs' ?
Thanks.

Jawelin
27 Jan 2002, 12:56
Also in member.php, you suggest to replace:
if ($avexists=$DB_site->query_first("SELECT userid FROM customavatar WHERE userid=$bbuserinfo[userid]")) {
$DB_site->query("UPDATE customavatar SET filename='".addslashes($avatarfile_name)."',dateline='".time()."',avatardata='".addslashes($filestuff)."' WHERE userid=$bbuserinfo[userid]");
} else {
$DB_site->query("INSERT INTO customavatar (userid,avatardata,dateline,filename) VALUES ($bbuserinfo[userid],'".addslashes($filestuff)."','".time()."','".addslashes($avatarfile_name)."')");
}
with:

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)."')");

It seems absolutely inaccurate, as you say to replace a different piece of code (than Kier's/Bira's VB 2.0.x version), because in 2.2.1 that's the actual code, WITH THE SAME piece they specified... :confused:

I got many many more 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
30 Jan 2002, 17:11
^BUMP^

newvbuser
30 Jan 2002, 19:07
Hi what's the performance issue prob if I use the default method which stores custom avatars into the database?? I have about 40 users who would want custom avatars.

c-pr0mpt
02 Feb 2002, 11:34
How do I uninstall the things this hack did? I did the install and the editing all errored, and when i went bck to the board the avatars were all still hosted via database.

newvbuser
04 Feb 2002, 08:43
Hmm it seems people here are releasing lots of unfinished hacks that do not work with the new versions of vB and they are called "finished" hacks :(

Jawelin
05 Feb 2002, 10:22
Originally posted by newvbuser
Hmm it seems people here are releasing lots of unfinished hacks that do not work with the new versions of vB and they are called "finished" hacks :(
Agree... :cry:

Graphic-Forums
02 Mar 2002, 19:24
Yeah, I also did the manual install and the avatars don't show now. Whats the problem?

fabz
11 Mar 2002, 21:31
May you tell me if this hack works with vb 2.2.3b ?

I would like to try this but not to hang the bb...
thanx

thewiz
15 Mar 2002, 17:56
Hi

OK I did the Hack from the install everything worked great until the End First you must create the directory you want chmod it to 777 then you have to go to your files /forum and chmod the files listed like showthread,member,private and announcement then goto the admin directory and chmod to 777 function.php,and user.php files I did all this and the install went in fine. BUT


Please help me on this one! Now when I goto User CP Edit Options Change Avatar it comes up BUT It extends to the right along way is there anyway to change that. I have had user that don't see the upload function because it is way off the screen.

Please Help

Armando

Boothby
21 Mar 2002, 18:20
Does this hack work with vB 2.2.4?

Kier
22 Mar 2002, 08:20
Originally posted by Boothby
Does this hack work with vB 2.2.4? Did it ever work? Try the original version: http://www.vbulletin.org/forum/showthread.php?s=&threadid=11760

It works fine with all recent versions of vBulletin.

Chen
22 Mar 2002, 11:57
Like Kier already pointed out, this hack already exists and works fine with the latest vBulletin release (http://www.vbulletin.org/forum/showthread.php?s=&threadid=11760), so there's really no need in another confusing thread, especially when the author has disappeared and can't provide further support.