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

Reply
 
Thread Tools
Thumbnail of Attachments on forum display Details »»
Thumbnail of Attachments on forum display
Version: 1.00, by Dechevious Dechevious is offline
Developer Last Online: Oct 2005 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 12-21-2004 Last Update: Never Installs: 72
 
No support by the author.

This hack has been requested a number of times, for multiple versions of vBulletin. For whatever reason, it was never done (at least publicly) until now. Heres to wishing each and everyone of you a Merry Christmas, and a prosperous, healthy, and safe, New Year!

What it does: This hack will display a thumbnail of the threads attachment on the forum display. Quite useful if you have forums designated for graphics/photos .. etc. Could also be tweaked to display the posters avatar instead of an attachment. Variable possibilities. (Screenshot attached for further review) and or see it in action at this forum in realtime. If the thread has multiple attachments, it will display the first. If no attachment, a 'no attachment' thumb will appear. Can be assigned for use in any forum you wish it to be active in.

Install time is minimal - Less than 5 minutes for the average joe. (Simplicity at it's Finest)
1 file to modify, and 1 template to modify, along with the upload of an image.

Known Issues: If the attachment is not an image, a thumbnail will not be shown. (IE: .zip or .rar)

If you install it, please click the 'Install' icon - Updates will be sent to those who do.

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #132  
Old 04-16-2005, 09:04 PM
memobug memobug is offline
 
Join Date: Jun 2002
Posts: 418
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Delphy,

What you're suggesting sounds interesting. I would be interested in seeing it. What I did, to enable USERS to chose the thumbnail option or not is to create a copy of the style with thumbnails turned on. That way the user can make the selection.

People on broadband really like it. The ones on dialup sometimes prefer not to load extra images. So I think it's a feature that might best be in the hands of the user rather than the admin. However, one thing I could really use would be the capability to show fewer threads per page if its a thumbnail view, and more threads per page in nothumbs. That would help to normalize the scrolling and load time.

Regards,

Matt
Reply With Quote
  #133  
Old 04-17-2005, 10:50 AM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

memobug,

What I did was set a limit of 10 threads if viewing thumbnails, or the normal 25 if viewing forums without thumbnails.

I agree with you on the user selectable thumbnails though - especially in the New Posts search screen. I hadn't considered a style becuase it would still do the mySQL queries to get the attachment ids even if it's not showing the thumbnails, unless you hardcoded the styleid into the php and checked against that.

To change the number of threads on a forum that has thumbnails:

Edit forumdisplay.php
Find the section where you define forumids
Code:
        $forumids = array(41, 43, 44, 45, 46, 47, 48, 49, 69, 70, 40, 50, 51, 52, 97, 98);
        if (in_array($forumid, $forumids)) {
                $displaythumbs = true;
BELOW this add:

Code:
                $perpage = 10;
Thats it. You could add this as a vBulletin option too.
Reply With Quote
  #134  
Old 04-19-2005, 11:26 PM
sicloan sicloan is offline
 
Join Date: Jul 2004
Location: washington
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Delphy
To change the number of threads on a forum that has thumbnails:

Edit forumdisplay.php
Find the section where you define forumids
Code:
        $forumids = array(41, 43, 44, 45, 46, 47, 48, 49, 69, 70, 40, 50, 51, 52, 97, 98);
        if (in_array($forumid, $forumids)) {
                $displaythumbs = true;
BELOW this add:

Code:
                $perpage = 10;
Thats it. You could add this as a vBulletin option too.
this worked if you changed the page. But not if you view a forum by itself.
Reply With Quote
  #135  
Old 04-21-2005, 05:16 PM
Bent Concepts Bent Concepts is offline
 
Join Date: Mar 2005
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is really a great hack -- but i'd love to know how to do it in the search results also. my php knowledge is fairly minimal -- any ideas?
Reply With Quote
  #136  
Old 04-22-2005, 08:46 AM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sicloan, works fine here. Might be becuase of some small other changes I made.

Bent, you need to alter search.php

Find:
Code:
        // #############################################################################
        // show results as threads
        else
        {
                $show['threadicons'] = true;
                $show['forumlink'] = true;

                foreach ($itemids AS $thread)
                {
                        // add highlight words
                        $thread['highlight'] = &$highlightwords;

                        // get info from thread
                        $thread = process_thread_array($thread, $lastread["$thread[forumid]"]);
(Should be around line 2518)

AFTER this add:

Code:
                        // Delphy's Search Thumbnail Hack
                        $thread[attachmentid] = "";
        $forumids = array(1, 2, 3);
        if (in_array($thread[forumid], $forumids)) {
                                        $displaythumbs = true;
                                        $sql_images = "SELECT DISTINCT postid,attachmentid FROM " . TABLE_PREFIX ."attachment WHERE postid IN (0$thread[firstpostid]) AND thumbnail_dateline > 0";
                                        $images = $DB_site->query($sql_images);
                                        while ($image = $DB_site->fetch_array($images)) {
                                                $thread[attachmentid] = $image[attachmentid];
                                        }
                                        $DB_site->free_result($images);
                                        unset($image);
                                }
Replace 1,2,3 with the forum ids similar to the way you did in forumdisplay.php
Reply With Quote
  #137  
Old 04-22-2005, 03:40 PM
Bent Concepts Bent Concepts is offline
 
Join Date: Mar 2005
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks a million -- that's really great stuff there. it seems to work, but unfortunately it's only displaying the nothumb.gif image -- as if there was no image in the thread (even though there is)

other thing is that that codeblock was around 1200 something, not 2518 -- must be installed mods on your search.php or something

my codeblock in search.php looks like this:

PHP Code:
// #############################################################################
    // show results as threads
    
else
    {
        
$show['threadicons'] = true;
        
$show['forumlink'] = true;
 
        foreach (
$itemids AS $thread)
        {
            
// add highlight words
            
$thread['highlight'] = &$highlightwords;
 
            
// get info from thread
            
$thread process_thread_array($thread$lastread["$thread[forumid]"]);
 
// Delphy's Search Thumbnail Hack
$thread[attachmentid] = "";
$forumids = array(1,2,3,4,5,6,7,);
if (
in_array($thread[forumid], $forumids)) {
$displaythumbs true;
$sql_images "SELECT DISTINCT postid,attachmentid FROM " TABLE_PREFIX ."attachment WHERE postid IN (0$thread[firstpostid]) AND thumbnail_dateline > 0";
$images $DB_site->query($sql_images);
while (
$image $DB_site->fetch_array($images)) {
$thread[attachmentid] = $image[attachmentid];
}
$DB_site->free_result($images);
unset(
$image);
}
 
            
$itemcount++;
            
exec_switch_bg();
            eval(
'$searchbits .= "' fetch_template('threadbit') . '";');
        }
    }
    
// ############################################################################# 
Reply With Quote
  #138  
Old 04-23-2005, 06:54 AM
skokarl skokarl is offline
 
Join Date: Apr 2005
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have installed, but i can't see anything.

Must I change something in the admin cp ?
Reply With Quote
  #139  
Old 04-25-2005, 01:21 PM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

skokari,

did you change the forum ids to the same ones you want thumbnails to appear in?

bent concepts,

hrm I haven't modified search.php that much at all... so it's weird that yours is on a different line. What version you running? 3.0.7 here
Reply With Quote
  #140  
Old 04-26-2005, 07:36 PM
Bent Concepts Bent Concepts is offline
 
Join Date: Mar 2005
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm running 3.07 also.

i hadn't changed it at all from the base unmodified version. what it's doing is displaying the "no thumb" image for all the items in the search.

is that code change the only thing that needs to be done in search.php? is there a specific version of this hack that needs to be used in order to get the search to work? i just changed the hack code i was using to the December 20th, 2004 version.

thanks
Reply With Quote
  #141  
Old 04-28-2005, 06:12 PM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hrm

It might be your $forumids = array(1,2,3,4,5,6,7,); line. Try taking out the last , in that.

What I found handy when developing the hack was doing this:
Code:
if ($bbuserinfo[userid] == 1) {
  echo "<pre>".print_r($thread, true)."</pre>";
}
Replace 1 with your userid. What this will do is *just* for you, print out ALL the information it's got in your browser window. You can then see what the values are for the $thread[attachmentid] etc

Obviously turn it off before you go live
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 05:03 AM.


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.05206 seconds
  • Memory Usage 2,334KB
  • Queries Executed 26 (?)
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
  • (7)bbcode_code
  • (1)bbcode_php
  • (1)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