vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Add-On Releases - [DRC] - Thread Starter Avatars (https://vborg.vbsupport.ru/showthread.php?t=322378)

Dr.CustUmz 04-16-2016 02:07 AM

ah that would be why, this pulls the avatar from image.php which I believe the image has to be in the database for that.

this is the exact code for the image src
Code:

image.php?u=$thread[postuserid]&type=thumb
I will make a note of this in the description, and will see if I can fix it =)

Max Taxable 04-16-2016 02:11 AM

Glad i could be helpful. Looks like a great little Mod, adds almost zero to pageload.

MarkFL 04-16-2016 02:23 AM

I don't know if it works the same in vB 3 as in vB 4, but in vB 4, when I want to get a user's avatar from the file system, I use code in the following form:

PHP Code:

$avatar_url fetch_avatar_url($userid);
$avatar $avatar_url[0];

if (!
$avatar)
{
    
$avatar $vbulletin->stylevars['imgdir_misc']['imagedir'] . '/unknown.gif';


edit: I forgot, you will likely need this before the call to the fetch_avatar_url() function:

PHP Code:

require_once('./global.php');
require_once(
'./includes/functions_user.php'); 


Dr.CustUmz 04-16-2016 02:49 AM

Quote:

Originally Posted by MarkFL (Post 2569063)
I don't know if it works the same in vB 3 as in vB 4, but in vB 4, when I want to get a user's avatar from the file system, I use code in the following form:

PHP Code:

$avatar_url fetch_avatar_url($userid);
$avatar $avatar_url[0];

if (!
$avatar)
{
    
$avatar $vbulletin->stylevars['imgdir_misc']['imagedir'] . '/unknown.gif';


edit: I forgot, you will likely need this before the call to the fetch_avatar_url() function:

PHP Code:

require_once('./global.php');
require_once(
'./includes/functions_user.php'); 


well before seeing this, at least I was on the right track lol

Code:

require_once('./includes/functions_user.php');
        $userid = $thread['postuserid'];
        $avatarurl = fetch_avatar_url($userid);


Dr.CustUmz 04-16-2016 03:20 AM

1 Attachment(s)
what i ended up coming up with
Code:

require_once(DIR . '/includes/functions_user.php');
$drcav = fetch_avatar_url($thread[postuserid]);
if (!$drcav) {
  $drcav = $stylevar['imgdir_misc'] . '/unknown.gif';
} else {
  $drcav = $vbulletin->options['bburl'] . '/' . $drcav[0];
}

but good news and bad news. this works but will cause an additional query per avatar on the page since it has to fetch it, with avatars in file system there is no way around this, unless...

food for thought (for me to return to lol)
Code:

you take $vboptions[SomeFolderNameOption]/avatar$thread[postuserid]_1.gif
but how to get that pesky revision number... hmm

$array['avatarrevision']

so to keep with the products title, i can not in good faith release this as an update. What i can do though is release another version altogether =) that way both sides can be happy... I hope. but its past 1 am here

heres a quick fix for now, i will release the revised version when i wake up

THIS IS ONLY FOR AVATARS IN FILESYSTEM! and was intended to fix max's issues to be good enough for now

and does not work in search results till tomorrow, only forumdisplay as im doing it as a quick fix before bed. again i will work the rest out tomorrow

MarkFL 04-16-2016 04:22 AM

You can detect if the avatars are in the file system with:

PHP Code:

$vbulletin->options['usefileavatar'

This will be an integer value of 1 if the file system is being used, and an integer value of 0 if the database is being used.

Dr.CustUmz 04-16-2016 12:31 PM

Quote:

Originally Posted by MarkFL (Post 2569066)
You can detect if the avatars are in the file system with:

PHP Code:

$vbulletin->options['usefileavatar'

This will be an integer value of 1 if the file system is being used, and an integer value of 0 if the database is being used.

yeah but how does that help lol, say i were to use for the img src

Code:

$vboptions[avatarurl_2]/avatar$thread[postuserid]_1.gif
that would work by itself, without a query. but that _1 at the end is the revision number, so I would need something like $thread[postuseridAvatarRev] where the 1 is, and i dont see any way of doing this without creating queries.

I guess for now i can combine it into one product using, ill just inform that if your avatars on your file system it will create a query for avatar loaded.

Code:

if $vbulletin->options['usefileavatar'] ==1{
USE QUERIES
} ELSE {
NO QUERIES
}


Max Taxable 04-16-2016 05:36 PM

Datastore? Possible to use that?

Dr.CustUmz 04-16-2016 05:53 PM

Quote:

Originally Posted by Max Taxable (Post 2569098)
Datastore? Possible to use that?

as they say in developing 'anything is possible' lol, but beyond my skillset, this is =P

can you give me an example? a product that uses this method, a way vbulletin uses it? im looking into it now too :D

Dr.CustUmz 04-16-2016 05:57 PM

it doesnt even touch the page load whether you have the additional queries or not though (at least from what Ive seen). all the queries mean, is it's asking the database for more information. on some products, queries matter, but from the testing ive put on my crappy little server sitting next to me i have not noticed any stress at all =) and its just a little ubuntu server i made from old pc parts, so if your site is on a real server youll have no issues =)

found a good article, but this may have to wait =)
https://vborg.vbsupport.ru/showthread.php?t=110628


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

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02211 seconds
  • Memory Usage 1,758KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete