Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Kier Kier is offline
Developer Last Online: May 2011 Show Printable Version Email this Page

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.

Comments
  #152  
Old 12-15-2001, 02:30 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

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!
Reply With Quote
  #153  
Old 12-15-2001, 05:33 PM
MaSTaKiLLaH MaSTaKiLLaH is offline
 
Join Date: Oct 2001
Location: Hannover, Germany
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

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

Code:
$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 ?
Reply With Quote
  #154  
Old 12-24-2001, 12:51 AM
Sadie Frost's Avatar
Sadie Frost Sadie Frost is offline
 
Join Date: Dec 2001
Location: Pittsburgh
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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"):

Quote:
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:

Quote:
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"):

Quote:
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:

Quote:
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:
Quote:
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
Reply With Quote
  #155  
Old 12-24-2001, 05:21 AM
Spankers Spankers is offline
 
Join Date: Nov 2001
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #156  
Old 12-26-2001, 12:19 PM
Sadie Frost's Avatar
Sadie Frost Sadie Frost is offline
 
Join Date: Dec 2001
Location: Pittsburgh
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bira's instructions work fine, actually

just look for "rb" instead of "r" and take out that extra {if you get a parse error
Reply With Quote
  #157  
Old 01-11-2002, 04:06 PM
mvigod mvigod is offline
 
Join Date: Dec 2001
Location: Jersey
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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.
Reply With Quote
  #158  
Old 01-14-2002, 10:14 AM
PK-Fortis's Avatar
PK-Fortis PK-Fortis is offline
 
Join Date: Nov 2001
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #159  
Old 01-15-2002, 11:53 AM
Jawelin Jawelin is offline
 
Join Date: Nov 2001
Posts: 557
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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
Reply With Quote
  #160  
Old 01-15-2002, 02:06 PM
mvigod mvigod is offline
 
Join Date: Dec 2001
Location: Jersey
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #161  
Old 01-23-2002, 03:45 AM
ScottW ScottW is offline
 
Join Date: Nov 2001
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^ bump
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:05 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04843 seconds
  • Memory Usage 2,321KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete