Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

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
  #22  
Old 12-23-2004, 07:49 PM
Dechevious Dechevious is offline
 
Join Date: Dec 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lasto
so what happens on your board m8 if your attachment is a rar - does it display a red X ?
At the moment, Yes. We're working to resolve that particular issue.
Reply With Quote
  #23  
Old 12-24-2004, 08:51 AM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lasto
so what happens on your board m8 if your attachment is a rar - does it display a red X ?
Mine is displaying the posticon if there's no screenshot to be shown. This hack is designed to work for only one forum which is an image gallery. Therefore I can make sure any thread has an image
Reply With Quote
  #24  
Old 12-24-2004, 06:45 PM
Dechevious Dechevious is offline
 
Join Date: Dec 2004
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MrNase
Mine is displaying the posticon if there's no screenshot to be shown. This hack is designed to work for only one forum which is an image gallery. Therefore I can make sure any thread has an image
Care to share how you accomplished determining if the file was an image or a zip or rar or any other file, without querying the server to its death?
Reply With Quote
  #25  
Old 12-25-2004, 02:47 PM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure

I use the following code:
PHP Code:
                 // Thumbnails
              
if($foruminfo['forumid'] == 22 AND $getpostid $DB_site->query_first("
              SELECT postid FROM " 
TABLE_PREFIX "post WHERE threadid = $thread[threadid] LIMIT 1"))
              {
                  
$attachment $DB_site->query_first("
                  SELECT filename, attachmentid, IF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail
                  FROM " 
TABLE_PREFIX "attachment
                  WHERE postid = 
$getpostid[postid]
                      ORDER BY rand() LIMIT 1
                      "
);
                  
$attachmentid $attachment['attachmentid'];
                  
$hasthumbnail $attachment['hasthumbnail'];
                  }
                  
// Thumbnails 
which reads out the attachmentids only from the images which have thumbnails. This excludes all txt or pdf or other files which are not images.
ORDER BY rand() LIMIT 1 tells him to output a randomly chosen attachment.

Together with the following conditional in the threadbit -Template it generates this beautiful gallery

HTML Code:
     	<if condition="$show['threadicons']">
     		<td class="alt2">
     	<if condition="$foruminfo[forumid] == 22 AND $hasthumbnail">
     	<img src="attachment.php?attachmentid=$attachmentid&stc=1&thumb=1" /> <else />
 	<if condition="$show['threadicon']"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if>
     	</if>
     	</if>
For some reasons this query doesn't work for any image and I couldn't find out why. But as most of the images work I don't care that much about it. Feel free to take my code and modify it
Reply With Quote
  #26  
Old 12-27-2004, 04:42 PM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay I've been working on the problem of displaying images regardless of whether the first attachment is an image or not.

The solution I came up with is as follows:

- Keeping the existing $threads SQL query, add the following into it: thread.firstpostid
- Add the following:
Code:
        $displaythumbs = false;
        $forumids = array(41, 42, 43, 44, 45, 46, 47, 48, 49, 69, 70, 40, 50, 51, 52, 97, 98);
        if (in_array($forumid, $forumids)) {
                $displaythumbs = true;
        }
The numbers indicate which forums you want the attachments to be displayed in - as you can see, multiple forums are ok.

- I have to add 1 extra query per forumdisplay page, which is:
Code:
                // Added by Delphy to add proper thumbnails
               if ($displaythumbs == true) {
                        while ($thread = $DB_site->fetch_array($threads))
                        { // AND $counter++<$perpage)
                                $imageposts .= $thread['firstpostid'].",";
                        }

                        if ($imageposts != "") {
                                $imageposts = substr($imageposts, 0, strlen($imageposts) - 1);
                                $sql_images = "SELECT DISTINCT postid,attachmentid FROM attachment WHERE postid IN (0$imageposts) AND thumbnail_dateline > 0";
                                $images = $DB_site->query($sql_images);
                                while ($image = $DB_site->fetch_array($images)) {
                                        $thumbnails[$image[postid]] = $image[attachmentid];
                                }
                                $DB_site->free_result($images);
                                unset($imageposts, $image);
                        }
                }
- Since we've already used a DB_site query, we need to reset the $threads resultset:
Find:
Code:
                while ($thread = $DB_site->fetch_array($threads))
Insert in the line above:
Code:
                $threads = $DB_site->query($sql_threads);
- Within the main while $thread loop that processes the threadbits, add the following:
Code:
                        $thread['attachmentid'] = $thumbnails[$thread['firstpostid']];
The resulting hack can be seen in http://forums.modthesims2.com/forumdisplay.php?f=69

Hope this helps somebody,

Regards
Delphy
Reply With Quote
  #27  
Old 12-27-2004, 04:46 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any chance of a text file doingthe full install but with these modifciations added because not everyone has added teh 1st version

also m8 the demo on your site gives this error

Unable to add cookies, header already sent.
File: /home/forums/public_html/forumdisplay.php
Line: 806
Reply With Quote
  #28  
Old 12-27-2004, 08:18 PM
mhobelsb mhobelsb is offline
 
Join Date: Oct 2004
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

mhmm... nice hack!
but i have a "problem". the nothumb image is displayed but the thumbs are not displayed. get a red cross...

where do i set the default icon via admincp? i don?t find the option...

gd2+ is installed and thumbnails are on.
Reply With Quote
  #29  
Old 12-27-2004, 08:54 PM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lasto, I was probably modifiying it again

mhobelsb, using the actual proper hack or my one?
Reply With Quote
  #30  
Old 12-27-2004, 09:21 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ive removed the attachment hack and will wait for u to do yours delphy as mine is showing red x`s if a rar is added as an attachemnt and it deffos needs a fix
Reply With Quote
  #31  
Old 12-27-2004, 11:22 PM
Delphy Delphy is offline
 
Join Date: Dec 2004
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay I've written up a text file in the style of the original, let me know if something doesn't work.

Updated 29th December at 5pm GMT to fix table prefixes and add a line I'd missed out from my original. Should work now

Regards,
Delphy
Reply With Quote
Reply

Thread Tools

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 08:43 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.06646 seconds
  • Memory Usage 2,321KB
  • 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
  • (5)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (3)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