Thread Thumbnail

99.NiNE

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

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.

Preview:
 
can you help me will this where can i find it

Be sure to change the forum ids in the $thumbsforums array to the forum ids you want to enable thumbnails in
 
mal920 said:
can you help me will this where can i find it

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


in thread-thumbnail-plugins.xml file look for
Code:
<phpcode><![CDATA[$tt_thumbsforums = array(2);
you need to change array (2) to your desire forums ids with comma for example
Code:
<phpcode><![CDATA[$tt_thumbsforums = array(3,4,7,5,11);
etc
 
@Ob3lix: No, it generates thumbs from attachments not link in, as far as I know there is no hack for that... yet.
@volgan: it works fine on my 3.7.2, re-check your edits.

If you want search/new posts link working on 3.7.2 (it's fucked);

New Post/Search fix 3.7.x

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.replycount, IF(thread.views=0, thread.replycount+1, thread.views) as views, thread.sticky,
thread.pollid, thread.open, thread.lastpost AS postdateline, thread.visible, thread.hiddencount, thread.deletedcount,
thread.lastpost, thread.lastposter, thread.lastpostid, thread.attach, thread.postusername, thread.forumid,

open search.php

find:
PHP:
	// do data query
	if (!empty($itemids))
	{
		$ids = implode(', ', array_keys($itemids));
		$dataQuery .= '(' . $ids . ')';
		$items = $db->query_read_slave($dataQuery);
		$itemidname = iif($search['showposts'], 'postid', 'threadid');

		$dotthreads = fetch_dot_threads_array($ids);
}

replace with:

PHP:
// do data query
if (!empty($itemids))
{
$ids = implode(', ', array_keys($itemids));
$dataQuery .= '(' . $ids . ')';
//edited by jason
$dataQuery .= " " . $hook_query_where; $items = $db->query_read_slave($dataQuery);
$itemidname = iif($search['showposts'], 'postid', 'threadid');
$dotthreads = fetch_dot_threads_array($ids);
}

fixed. :)

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:
PHP:
$hook_query_fields = $hook_query_joins = '';
($hook = vBulletinHook::fetch_hook('tags_list_query_data')) ? eval($hook) : false;
>>Change the 1st line to:
PHP:
$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:

PHP:
$hook_query_joins
WHERE thread.threadid IN (" . implode(',', $threadids) . ")
>>Change the 2nd line to:
PHP:
$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:

PHP:
<?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:
PHP:
<!-- 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!
 
it works good. but is there anyway that it uses the image that users posted via
 
Does anyone have any thoughts on how my guests can see the thumbnail images...

Nevermind I figured it out...

You have to allow download attachments in forum permissions for the forum you wish to display thumbnail pics to your guests.
 
Back
Top