Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Thread Thumbnail Details »»
Thread Thumbnail
Version: 1.1, by jasonmerchant jasonmerchant is offline
Developer Last Online: Jun 2009 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.6.8 Rating:
Released: 09-20-2007 Last Update: 09-20-2007 Installs: 209
Uses Plugins Template Edits
 
No support by the author.

This plugin is the newest version of the Thread Thumbnail plugin

This plugin will display the first attachment as a thumbnail on forumdisplay.php

New Features:
  • If there are attachments that are not images, it will skip them and go to the first image attachment.
  • Optional - you can now display thumbnails on search results.



Installation:

In your AdminCP, go to Plugin System, Download/Upload Plugins and import the xml document.

Be sure to change the forum ids in the $thumbsforums array to the forum ids you want to enable thumbnails in.

The plugin comes with the Search Thumbnails enabled. If you do not want to have thumbnails show up in the search results, make sure you deactivate it.

If you would like thumbnails to display in the search results, you will need to replace your search.php page with the one in the zip file. Unfortunately vBulletin forgot to include a hook variable where it is necessary for this to work. I have added 1 line to search.php with the hook variable. There is no way around this until vbulletin adds it themselves.

Next you will need to modify your threadbit template:

Find:
Code:
<if condition="$show['threadicons']">
	<td class="alt2">
		<if condition="$show['threadicon']">
			<img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
		<else />
			&nbsp;
		</if>
	</td>
</if>
Replace With:
Code:
<if condition="$show['threadicons']">
	<td class="alt2" align="center" valign="middle">
			<if condition="$tt_displaythumbs">
				<if condition="($thread['attachmentid']) AND ($thread['thumbsize'])">
			     	<a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
			          	<img src="attachment.php?attachmentid=$thread[attachmentid]&stc=1&thumb=1" alt="" border="0" />
			        </a>
			     <else />
			        <img src="$stylevar[imgdir_misc]/nothumb.jpg" alt="" border="0" />
			     </if>
			<else />
				<if condition="$show['threadicon']">
			     <img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
				 </if>
			</if>
	</td>
</if>
You will also need to upload an image to display if there are no image attachments here: $stylevar[imgdir_misc]/nothumb.jpg(ex: http://www.mysite.com/forums/images/misc/nothumb.jpg). I've made a simple one you can use or you can make your own. By default thumbnails are confined in a 100x100 px area, I found that it looks good to make the "no image" image about 100x83 px.

__________________________________________________ ___

Add-ons (Optional)

UserCP option to turn the thumbnails on/off on a per user basis

Go into your admincp and click User Profile Fields->Add New User Profile Field.

Select "single selection radio buttons", click continue.

For title put "Thread Thumbnails", for description put "This will allow you to turn the thumbnails of threads on and off."

For options, enter "On" and "Off".

Skip down to Display Page and choose "Options: Thread Viewing".

In your threadbit template(assuming you already applied the template changes above):

Find:
Code:
<if condition="$tt_displaythumbs">
Replace with:
Code:
<if condition="($tt_displaythumbs) AND ($bbuserinfo['field5'] <> 'Off' OR $show['guest'])">
You need to replace field5 with the field name of the profile field you created earlier.

Show Your Support

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

Comments
  #222  
Old 08-24-2008, 05:44 AM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

NeverBored, Nice approach.

The forum exclusion logic NeverBored wrote could also be incorporated into this plugin tweak of mine, making it at that point a fairly comprehensive as well as solid mod/hack that covers all the bases.

First & Foremost do this/test this in your testvb forum before actually doing this in your forrealzie vB forum.

This Thread Thumbnail tweak:
  • Keeps Jason's original 'your selected forum IDs' thread thumbnail logic in place, which shows NO THUMBNAIL AVAILABLE if no thread 1st post thumbnail.
  • Adds thread thumbnail display to all other forums. If there's no thread 1st post thumbnail then the vB default thread icon is displayed.
  • All img lines of code have been wrapped in href tags, not just the thumbnailed threads. [If this adds "Server Issues" then delete the href open/close a tag code wrap.]
Installation instructions:

1) Temp Disable, with eventual intent to delete, the Thread Thumbnail plugin.

2) Save the following code as an XML file, naming it whatever you want, e.g., thread-thumbnail-plugins-all-forums.xml. Then load this XML file through your Admin Control Panel > Plugins & Products > Download/Upload Plugins > Import Plugin Definitions XML File window, Import the .xml file you just created. This creates plugin 'Thread Thumbnails - All Forums'.
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<plugins>
<plugin active="1" executionorder="5" product="vbulletin">
<title>Thread Thumbnail - All Forums</title>
<hookname>forumdisplay_query</hookname>
<phpcode><![CDATA[$tt_thumbsforums = array(2);
$tt_displaythumbs = false;
if (in_array($forumid, $tt_thumbsforums)) {
$tt_displaythumbs = true;
}
$tt_displaythumbs_all = true;
$hook_query_fields .= ", attachment.thumbnail_filesize AS thumbsize , MIN(attachment.attachmentid) AS attachmentid ";
$hook_query_joins .= "LEFT JOIN " . TABLE_PREFIX . "attachment as attachment ON(attachment.postid = thread.firstpostid AND (attachment.extension = 'jpg' OR attachment.extension = 'gif' OR attachment.extension = 'png')) ";
$hook_query_where .= "GROUP BY thread.threadid "; 
]]></phpcode>
</plugin>
</plugins>
Add the forum IDs you want thumbnailed, the ones where you definitely expect art post attachments, to the $tt_thumbsforums array.

Click on a forum you want thumbnailed(, or look it up in AdminCP > Forums & Moderators > Forum Manager).
In the browser window you should see something like this:
yourforum.com/forums/forumdisplay.php?f=36
IN THIS EXAMPLE, 36 is your forum's forum ID. This goes in the array.
In AdminCP edit your Thread Thumbnail plugin, adding forum 36 to the array:
example, $tt_thumbsforums = array(36);
Separate multiple forums you want thumbnailed with a comma (,):
example, $tt_thumbsforums = array(36, 37);

3) In all your threadbit templates add this code tweaking it to your liking.

[Note: This code includes IF statements that handle thumbnailing 1) Tag Searches (see vB.org, Thread Thumbnails, page 13, Post # 193), 2) New Posts & regular Searches (see vB.org, Thread Thumbnails, page 12, Post # 169), 3) forums (original mod logic). Delete the IF statement section(s) that do NOT apply to you.]

Find in threadbit template:
Code:
<if condition="$show['threadicons']">
<td class="alt2"><if condition="$show['threadicon']"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>
</if>
Replace with:
Code:
<!-- OMAC Thread Thumbnails -->
<!-- in this code:  -->
<!-- All img lines of code have been wrapped in href tags, not just threads with thumbnails -->
<if condition="$show['threadicons']">
   <td class="alt2" align="center" valign="middle">
<!-- Tag Search -->
   <if condition="($tt_displaythumbs_tags)">
     <if condition="($thread['attachmentid']) AND ($thread['thumbsize'])">
        <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
            <img src="attachment.php?attachmentid=$thread[attachmentid]&stc=1&thumb=1" alt="" border="0" />
        </a>
     <else />
<!-- and, don't forget to close all the If stmts with vB's original If stmt code that we've just bastardized. -->
       <if condition="$show['threadicon']">
        <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
         <img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
        </a>
       <else />
         &nbsp;
       </if>
     </if>
<!-- end_of Tag Search -->
   <else />
<!-- New Posts & regular Search -->
     <if condition="($tt_displaythumbs_search)">
       <if condition="($thread['attachmentid']) AND ($thread['thumbsize'])">
          <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
              <img src="attachment.php?attachmentid=$thread[attachmentid]&stc=1&thumb=1" alt="" border="0" />
          </a>
       <else />
<!-- and, don't forget to close all the If stmts with vB's original If stmt code that we've just bastardized. -->
         <if condition="$show['threadicon']">
           <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
           <img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
           </a>
         <else />
           &nbsp;
         </if>
       </if>
<!-- end_of New Posts & regular Search -->
     <else />
<!-- Thread Thumbnails in All Forums -->
<!-- Your forum IDs you added to the $tt_thumbsforums array will show thread 1st post thumbnail or the "NO THUMBNAIL AVAILABLE" icon -->
       <if condition="($tt_displaythumbs)">
         <if condition="($thread['attachmentid']) AND ($thread['thumbsize'])">
           <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
           <img src="attachment.php?attachmentid=$thread[attachmentid]&stc=1&thumb=1" alt="" border="0" />
           </a>
         <else />
           <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
           <img src="$stylevar[imgdir_misc]/nothumb.jpg" alt="" border="0" />
           </a>
         </if>
       <else />
<!-- All Your NON-selected forums will show thread 1st post thumbnail or the vB default thread post icon -->
         <if condition="($tt_displaythumbs_all)">
           <if condition="($thread['attachmentid']) AND ($thread['thumbsize'])">
             <a href="showthread.php?$session[sessionurl]t=$thread[threadid]"> 
               <img src="attachment.php?attachmentid=$thread[attachmentid]&stc=1&thumb=1" alt="" border="0" />
             </a>
           <else />
<!-- and, don't forget to close all the If stmts with vB's original If stmt code that we've just bastardized. -->
             <if condition="$show['threadicon']">
               <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
                 <img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
               </a>
             <else />
               &nbsp;
             </if>
           </if>
<!-- end_of Thread Thumbnails in All Forums -->
         <else />
<!-- and, don't forget to close all the If stmts with vB's original If stmt code that we've just bastardized. -->
           <if condition="$show['threadicon']">
             <a href="showthread.php?$session[sessionurl]t=$thread[threadid]">
               <img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
             </a>
           <else />
             &nbsp;
           </if>
         </if>
       </if>
     </if>
   </if>
   </td>
</if>
<!-- end of OMAC Thread Thumbnails -->
Once you get this to work then go ahead and delete the original Thread Thumbnail plugin -OR- just keeping it disabled works too.

~OZ
Reply With Quote
  #223  
Old 08-25-2008, 12:01 AM
Shmaba Shmaba is offline
 
Join Date: Aug 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK for some reason the thumbnails dont show up when your viewing as a guest? How do we change it so its viewable for everyone?
Reply With Quote
  #224  
Old 08-25-2008, 12:54 PM
Shmaba Shmaba is offline
 
Join Date: Aug 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone else have a fix for this?
Reply With Quote
  #225  
Old 08-25-2008, 03:05 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Shmaba View Post
OK for some reason the thumbnails dont show up when your viewing as a guest? How do we change it so its viewable for everyone?
Guests (Unregistered/Not Logged in)
Under: Forum Viewing Permission
Parameter: Can Download Attachments must be set to YES.
Reply With Quote
  #226  
Old 08-28-2008, 01:59 AM
covertsem covertsem is offline
 
Join Date: Aug 2007
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would love to see this for 3.7 and would donate $5 to make it happen. PM me to claim your $
Reply With Quote
  #227  
Old 08-28-2008, 02:31 AM
NeverBored NeverBored is offline
 
Join Date: Feb 2008
Location: CA
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's works for 3.7
Reply With Quote
  #228  
Old 08-28-2008, 10:57 AM
steveninstl steveninstl is offline
 
Join Date: Jul 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK...I'm back...

I upgraded (I'm starting to hate upgrades) to VB 3.7.3 and I get this new SQL..


Database error in vBulletin 3.7.3:

Invalid SQL:

SELECT post.pagetext AS preview,
thread.threadid, thread.threadid AS postid, thread.title AS threadtitle, thread.iconid AS threadiconid, thread.dateline, thread.forumid,
thread.sticky, thread.prefixid, thread.taglist, thread.pollid, thread.open, thread.lastpost AS postdateline, thread.visible,
thread.hiddencount, thread.deletedcount, thread.attach, thread.postusername, thread.forumid,

replycount, IF(views<=replycount, replycount+1, views) AS views,
thread.lastpost, thread.lastposter, thread.lastpostid
,
deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,
user.userid AS postuserid


, attachment.thumbnail_filesize AS thumbsize , MIN(attachment.attachmentid) AS attachmentid
FROM thread AS thread
LEFT JOIN user AS user ON(user.userid = thread.postuserid)

LEFT JOIN deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND deletionlog.type = 'thread')


LEFT JOIN post AS post ON(post.postid = thread.firstpostid)

LEFT JOIN attachment as attachment ON(attachment.postid = thread.firstpostid AND (attachment.extension = 'jpg' OR attachment.extension = 'gif' OR attachment.extension = 'png'))
WHERE thread.threadid IN
GROUP BY thread.threadid;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY thread.threadid' at line 24
Error Number : 1064
Request Date : Thursday, August 28th 2008 @ 07:41:56 AM
Error Date : Thursday, August 28th 2008 @ 07:41:56 AM
Script : http://www.pimpmyberry.com/search.php?searchid=2966
Referrer :
IP Address : 1234567890
Username : StevenInSTL
Classname : vB_Database
MySQL Version : 5.0.51a-community




I did all the fixes to the search.php, and I still get the error...

Any idea?
Reply With Quote
  #229  
Old 08-28-2008, 03:14 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you have the 'Thread Thumbnail - Search' plugin turned ON - Did you change, add the TT code to, the vB3.7.3 search.php file? (see Post # 112 on Page 8)
If you have the 'Thread Thumbnail - Tag Search' plugin turned ON - Did you change, add the TT code to, the vB3.7.3 tags.php file? (see Post # 169 on page 12)
In my testvb instance I successfully upgraded to vB3.7.3, after adding the TT code to both search.php and tags.php, and both plugins work for me.
Reply With Quote
  #230  
Old 08-28-2008, 06:20 PM
jacobsen1 jacobsen1 is offline
 
Join Date: Dec 2007
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does this work with hotlinked images? ie [img]?

I've seen something working here:
http://www.inspiring-photography.com...isplay.php?f=7

and they seem to be linked images, not attachements... Any idea what mod that is if it's not this one?

Thanks
Reply With Quote
  #231  
Old 08-28-2008, 06:57 PM
NeverBored NeverBored is offline
 
Join Date: Feb 2008
Location: CA
Posts: 138
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jacobsen1 View Post
does this work with hotlinked images? ie [img]?

I've seen something working here:
http://www.inspiring-photography.com...isplay.php?f=7

and they seem to be linked images, not attachements... Any idea what mod that is if it's not this one?

Thanks
This mod doesn't work with hotlinked images. You should contact them and ask them to post in this thread how they're doing that.
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:08 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.09741 seconds
  • Memory Usage 2,337KB
  • 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
  • (7)bbcode_code
  • (2)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
  • (2)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