Version: , by Kier
Developer Last Online: May 2011
Version: 2.2.x
Rating:
Released: 03-18-2001
Last Update: Never
Installs: 52
No support by the author.
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.
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.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
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]";
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.
Follow the instructions in post #1 except for the following change:
the instructions for file admin/functions.php should be:
Quote:
Find:
PHP Code:
// ###################### 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:
PHP Code:
// ###################### 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:
PHP Code:
if ($post[hascustomavatar] and $avatarenabled) {
$avatarurl="avatar.php?userid=$post[userid]&dateline=$post[avatardateline]";
Replace with:
PHP Code:
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.