Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

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
  #162  
Old 06-27-2008, 10:33 PM
usmansabir's Avatar
usmansabir usmansabir is offline
 
Join Date: Jun 2008
Location: UK
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

3.6.8 .. installed . showed NO THUMBNAIL in the forums i defined in array .. and SQL error while going for New post .. so didnt have any option .. uninstalled but i like this thingi..
Reply With Quote
  #163  
Old 06-27-2008, 11:29 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

usmansabir,
This mod/hack is priceless if you have an art forum. This hack has worked for me from vB3.6.5 through vB3.7.2, but, since vB3.6.8 came out you have to tweak the search.php so new post search works (see page 8, post #112, 114). Also, don't forget you need to turn on thread thumb creation (see page 9, post #121). If you have linked and/or full image (non-thumbnailed) images in a new thread's 1st post then a thumbnail is NOT available, thusly, it won't show up as a thumbnail, regardless.
Reply With Quote
  #164  
Old 06-28-2008, 05:55 PM
Defkalion Defkalion is offline
 
Join Date: Jan 2007
Location: Athens, Greece
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@theOZer: have you found a way to make this work also in tag search?
Reply With Quote
  #165  
Old 06-29-2008, 05:08 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FYI: This mod and the search.php tweak work in vB3.7.2.
We're fortunate, once again, this works by bastardizing search.php. Yes, there has got to be a better way.
No, Defkalion, I have not worked with adding this to Tags. I'm not a coder but this does intrique me. I would like to, first and foremost, use vB's hooks in the search.php, to "properly" incorporate ThreadThumbnails into New Posts search. Then, maybe, after learning how to do that I can also do this in Tags; it may just fall all into place. There's a vB SDK (I believe) that I can download, read, then take it from there. We will see.
P.S. NeverBored also offers good help (page 8 - 10) on how to display 'full page' threads.
Reply With Quote
  #166  
Old 07-01-2008, 03:46 PM
rolfw1 rolfw1 is offline
 
Join Date: Nov 2005
Location: Berkshire, England
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All I did when I upgraded to 3.7.2, was upload the old modified search.php file (after I found that the new 3.7.2 version was generating an SQL error), did you modify your new 3.7.2 version, or just replace it with the old modified one, if you modified it, I'd like to see what you did, as I think I may be missing some features by using the old modified one.

Also, has anyone got it to work when searching for individual posts and not threads? As my main section is photo based and it would look a lot better.
Reply With Quote
  #167  
Old 07-01-2008, 05:17 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

rolfw1,
You HAVE TO MODIFY the vB3.7.2 search.php, adding the Thread Thumbnail 'hook' (see page 8, post #112, 114).
I believe that this mod, as it's currently written, only checks for an image attachment on the 1st post of a thread.
Reply With Quote
  #168  
Old 07-02-2008, 12:29 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yay! I got Thread Thumbnails to so show up in a TAG Search!!!

I created a Thread Thumbnail Tag Search plugin, copying thread-thumbnail-plugins.xml then tweaking it.
I had to make minor changes to Tag.php.
I had to add an additonal If statement to the threadbit template to get Tag search thumbnails to display.
I need to put together a 'How I Did This' write-up. I'll get this done today.
P.S. I plan to post my write-up, soon.
Reply With Quote
  #169  
Old 07-02-2008, 02:14 PM
Defkalion Defkalion is offline
 
Join Date: Jan 2007
Location: Athens, Greece
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

COOL!!!! Can't wait to implement this!
Reply With Quote
  #170  
Old 07-02-2008, 02:38 PM
theOZer's Avatar
theOZer theOZer is offline
 
Join Date: Mar 2007
Location: Colorado, USA
Posts: 212
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Adding Thread Thumbnails to Tag Search

Salute to Jason Merchant the original coder of this excellent Thread Thumbnails mod. Salute to vB.org for hosting this mod's thread.

This is a 'How I Did It.' I hope this is ethically correct that I can post this tweak, seeing how I stole the plugin from Jason and tags.php needs to be modified. I have this up-and-running on my forum; it works for me, okay?

tags.php needs to be slightly tweaked to make this all happen.
You will need to install a plugin.
You will need to modify your threadbit template(s).

[Note: Before changing your current tags.php file make a backup copy named tags_original.php, for example.]

A) Tweak the tags.php file:

Change tags.php

>>Find:

$hook_query_fields = $hook_query_joins = '';
($hook = vBulletinHook::fetch_hook('tags_list_query_data')) ? eval($hook) : false;

>>Change the 1st line to:

$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('tags_list_query_data')) ? eval($hook) : false;

At the bottom of the following select statement -

>>Find:

$hook_query_joins
WHERE thread.threadid IN (" . implode(',', $threadids) . ")

>>Change the 2nd line to:

$hook_query_joins
WHERE thread.threadid IN (" . implode(',', $threadids) . ") $hook_query_where

B1) Create the plugin .xml file:

Copy the following xml code, pasting it into Wordpad or Notepad. Save the file as a .xml. For example, I named mine: thread-thumbnail-plugins-tags.xml

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
	<plugin active="1" executionorder="5" product="vbulletin">
		<title>Thread Thumbnail - Tag Search</title>
		<hookname>tags_list_query_data</hookname>
		<phpcode><![CDATA[$tt_displaythumbs_tags = 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>
B2) Import the plugin:

In Admin Control Panel > Plugins & Products > Download/Upload Plugins > Import Plugin Definitions XML File window, Import the .xml file you just created.

C) threadbit template changes:

Here's my New & Improved threadbit template change to thread thumbnail both regular searches and Tag searches. Your current TT code may differ from mine, for sure.

Code:
<!-- Thread Thumbnails -->
<if condition="$show['threadicons']">
   <td class="alt2" align="center" valign="middle">
<!-- TAG Search Thread Thumbnails -->
   <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 />
       <if condition="$show['threadicon']">
         <img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" />
       <else />
         &nbsp;
       </if>
     </if>
   <else />
<!-- Thread Thumbnails in Forums & Search -->
     <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" />
       <else />
         &nbsp;
       </if>
     </if>
   </if>
   </td>
</if>
<!-- end of Thread Thumbnails -->
Enjoy!

Regards, theOZer
Reply With Quote
  #171  
Old 07-02-2008, 03:20 PM
Defkalion Defkalion is offline
 
Join Date: Jan 2007
Location: Athens, Greece
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aaarrrgh!! It works!!

I just have to figure out why it's leaving such a big space for the thumbs column now. :P

Many thanks man. Any ideas for the thumbs column width?

Edit: Don't worry about it, already fixed it, it was an extra </td> making the damage.

It's working GREAT!

Thankyou so much for your effort theOZer
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 10:17 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.06056 seconds
  • Memory Usage 2,323KB
  • 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
  • (6)bbcode_code
  • (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