Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Thread Thumbnails Details »»
Thread Thumbnails
Version: 3.1.0, by Null Parameter Null Parameter is offline
Developer Last Online: Apr 2014 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 4.0.x Rating:
Released: 03-02-2010 Last Update: 04-29-2010 Installs: 243
DB Changes Uses Plugins Auto-Templates
Translations  
No support by the author.

Thread Thumbnails
Created By: Null Parameter

The Thread Thumbnails mod allows users of a forum to specify, in several possible ways, a thumbnail for their thread to be displayed on Forumdisplay thread list.

I had created the mod for vB 3.8, but people we're crying out for a ported version to vB4, and, thanks to help from several of the members, here it is!


Description of Features

Thumbnails are displayed on the Forumdisplay next to the threadicon.
In the ACP Options, assuming you are using the Auto-Template Edits, you can choose which side of the icon to display it on.

Forum Display Screenshot


When submitting a new thread or editing the first post of a thread, a thumbnail can be specified directly if the User Entered URL option is chosen in the ACP. Another option is to Require the thumbnail. If the thumbnail isn't required, it may be left blank by the user, and it can either not be shown at all on forumdisplay or be replaced by a default thumbnail image specified in the ACP.

New Thread Screenshot

Edit Post Screenshot


All available options in the ACP include...
  • Turn Off/On Thumbnails
  • Turn Off/On Auto-Template Edits
  • Which forums to use thumbnails in
  • Turn Off/On thumbnails on sticky threads
  • Require thumbnails (doesn't work with attachment option)
  • Choose to retrieve thumbnails from one of the following
    • User Entered URL
    • First Attachment
    • First Image in Post
  • Choose where thumbnail is displayed in threadbit (relies on Auto-Template Edits)
  • Thumbnail CSS Style
  • Specify No Thumbnail Replacement Image
ACP Options Screenshot


This version is also now using phrases, so it can more easily be translated!


Installation

Install the product XML file. That's it!

If you have a highly customized style, there is a chance that the auto-template edits will not work. In that case, you will need to make the template edits manually. See the included README for more details.


Thumbnail Style

The style for thumbnails is specified in the ACP. It is used to choose exactly how thumbnails will be displayed, including width, height, margins, borders and many other attributes.

The style is specified in CSS, and is applied directly to the HTML img tag.

Here are some examples of possible thumbnail styles, along with a description of what they will do. If you don't know much about CSS, you can learn more here.
  • Every thumbnail will have a width of 100 pixels, but be constrained to being a maximum of 150 pixels in height
    • width:100px;max-height:150px;
  • Every thumbnail will have a width of 120 pixels and have a margin of 3 pixels around the thumbnail, so that it doesn't touch any of the other elements in the threadbit
    • width:120px;margin:3px;
  • Thumbnails aren't allowed to exceed 150 pixels in either dimension, and are also mildly transparent
    • max-width:150px;max-height:150px;opacity:0.8;filter:alpha(opacity=80);
Note: Using CSS positioning attributes (i.e. position, float, clear, etc.) could mess up the threadbit structure, so beware.


FAQs

The version of this mod for vB 3.8 showed thumbnails in the search results. Where did they go?
The search system between vB 3.x and vB4 changed significantly. I didn't have the time to figure out the complexity of it, and was unable to find any examples of other mods that integrated into the search results.

If you know how this is done, feel free to contact me and we can work to get this feature back in!
Does this mod work for RTL Languages, such as Arabic?
There is a separate product XML file available for download that has the appropriate changes to support RTL languages.
When I choose the First Image in Post option, no thumbnails show up in my current threads. Why?
Thumbnails are only updated when a new thread is created or when the first post is edited. Parsing through every forum/thread whenever the options are changed could be disastrous for performance.

Luckily, a user of this mod, megamoose, created a script that you can use to help this out. I want this method to be known, but because I didn't write this, I make no promises that it will work.

Quote:
Originally Posted by megamoose View Post
This should enable batch processing. I have tested it.
Change the $STEP_AMOUNT at the top to something lower if you still get errors
Remember this is for vB version 3.8
Always backup your data before running scripts like these

TO THOSE WHO HAVEN'T BEEN FOLLOWING THE CONVERSATION:
This script will go through all your existing posts and give them thumbnails, based on the First IMG in post option.

Code:
<?php $STEP_AMOUNT = 600; ?>

<input type="button" id="btnNext" value="Process Next Results" onClick="window.location='?start='+(<?php echo $_GET["start"]; ?>+<?php echo $STEP_AMOUNT;?>)" disabled=true><br>
The button above should enable once this batch is complete!<br>
<br>

<?php
error_reporting(E_ALL & ~E_NOTICE & ~8192);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('SKIP_SESSIONCREATE', 1);
define('NOCOOKIES', 1);
define('THIS_SCRIPT', 'xupdate');
define('CSRF_PROTECTION', true);

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array();

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

if (!$_GET["start"]) { $_GET["start"] = 0; }


        $threads = $db->query_read_slave("
        SELECT *
        FROM " . TABLE_PREFIX . "thread
        LIMIT ".$db->escape_string($_GET["start"]).",". $db->escape_string($_GET["start"]+$STEP_AMOUNT));

while ($thread = $db->fetch_array($threads)){
    echo "<b>Thread:</b> ".$thread["title"]."<br>";

    $posts = $db->query_read_slave("SELECT * FROM `" . TABLE_PREFIX . "post` WHERE `postid` = '".$thread["firstpostid"]."'");
    $post = $db->fetch_array($posts);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <b>First Post:</b> ".$post["title"]."<br>";
preg_match('/\[img\](.*?)\[\/img\]/i',$post["pagetext"],$matches);
$query = "UPDATE `" . TABLE_PREFIX . "thread` set `thumbnailurl` = '".$db->escape_string($matches[1])."' WHERE threadid = " . $thread["threadid"];
echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <b>SQL:</b>".$query."<br><br>";
$db->query_write($query);

}
?>

<script> document.getElementById("btnNext").disabled = false; </script>
Translations

Arabic

Versions

v3.1
  • Fix for Required Thumbnails
  • New feature to automatically use ALL Forums
v3.0
  • Support for vB4!
  • Use Phrases
  • Option to make Thumbnails Required
  • Option to select where to show the thumbnail on Forumdisplay
  • Option to specify the CSS Style of thumbnail images
Mod Support

I am fully willing to support this mod and continue to add new feature to it when they are desired enough to make them applicable to the product as a whole. The issue is that I do not have access to a vB4 installation, and therefore cannot develop.

Several people were gracious enough to offer up a test installation for me to use, and that is how this mod exists today. If any new features/fixes are wanted, other people will need to be just as gracious.

Also, since I don't own a vB4 instance, I'm supporting this strictly out of the kindness of my heart. So, if you wish to Support me as a developer, it would be much appreciated.

Enjoy!

Download Now

File Type: zip product-thread_thumbnails_v31.zip (313.3 KB, 1895 views)
File Type: xml product-thread_thumbnails_RTL.xml (19.2 KB, 609 views)

Screenshots

File Type: png forumdisplay.png (148.2 KB, 0 views)
File Type: png editpost.png (24.6 KB, 0 views)
File Type: png newthread.png (36.1 KB, 0 views)
File Type: jpg adminoptions.jpg (121.5 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
misericorde

Comments
  #142  
Old 08-20-2010, 08:57 PM
fxwoody's Avatar
fxwoody fxwoody is offline
 
Join Date: Jun 2010
Location: On Earth
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, i modified my set up in my V4.0.6 and with codes and reference that i found in here and...it works OK! Lolll

Here's the changes i made (Tks to every one who has posted Codes and ideas, as none of these are my creation)

These changes have to be done in every skins that you have in order to make it work. Also, the option for "First Image In Post" and "First Attachment" are working well but got stuck with the "User entered URL" and this one is not showing properly
Still, it works as it should in V4.0.6

Now, replace or copy these in the templates:

In the Threadbit:

Find:
PHP Code:
  <vb:if condition="$show['threadicon']">
                                                <
img src="{vb:raw thread.threadiconpath}" alt="{vb:raw thread.threadicontitle}" border="0" />
                                        </
vb:if> 
Paste this after:

PHP Code:
<!----autothumbnail--->
                                      <
vb:if condition="!$thread['thumbnailurl']">
                <
class="threadstatus" rel="vB::AJAX" title="
                <vb:if condition="
$show['threadcount']">
                    {vb:rawphrase have_x_posts_in_thread_last_y, {vb:raw thread.dot_count}, {vb:raw thread.dot_lastpost}}
                </vb:if>
                "
></a>
                          </
vb:if>
<!----/
autothumbnail---> 

In the template "thread_thumbnail_threadbit"

You should have this code in it:

PHP Code:
<vb:if condition="$thread['thumbnaildisplay'] AND (!$thread[sticky] OR ($vbulletin->options[thread_thumbnails_sticky] == '1'))">
            <
a href="{vb:link thread, {vb:raw thread}}" id="thread_gotonew_{vb:raw thread.realthreadid}" style="float:left;clear:right;display:block;margin:2px;"><img style="{vb:raw thread.thumbnailstyle}" src="{vb:raw thread.thumbnailurl}"></a>
        </
vb:if> 

In the plugin manager : New Thread - Save Thumbnail, Datamanager >>> "Modify with this" :

PHP Code:
if ($type == 'thread')
            {
                if(
$vbulletin->options['thread_thumbnails_thumbnail_source'] == '0')
                {
                    
$dataman->setr('thumbnailurl'htmlspecialchars_uni($post['thumbnailurl']));
                }
                if(
$vbulletin->options['thread_thumbnails_thumbnail_source'] == '2')
                {
                
preg_match('/\[img\](.*?)\[\/img\]/i',$post['message'],$matches);
                
                
$dataman->setr('thumbnailurl'$matches[1]);
                }              
            } 
As for the rest of the normal template edit from the main post, i haven't modify anything from it.
The options in the "Thread Thumbnails Options" are all set to yes and the "Thumbnail Location" works fine in both before or after the Threadicon.

Also, if you want to re-size the thumbnail you can use this:
PHP Code:
max-width:40px;max-height:60px;border1px ridge
and change the px to the one you would like to see.

If no images are in the posts, i made myself a small pic that i FTP to the images root of my site and this part of it worked OK too
EX: /vb4/images/misc/test-posbit.gif

Hope it will help a few of you guys that wanted this cool plugin
Reply With Quote
  #143  
Old 08-20-2010, 09:24 PM
rolfw1 rolfw1 is offline
 
Join Date: Nov 2005
Location: Berkshire, England
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well done, that should help a lot of people.
Reply With Quote
  #144  
Old 08-20-2010, 10:44 PM
fxwoody's Avatar
fxwoody fxwoody is offline
 
Join Date: Jun 2010
Location: On Earth
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rolfw1 View Post
Well done, that should help a lot of people.
Tks rolfw1 Tho now i made a doodoo in my database with the script trying to get all the thumbnails to show! lolll

ohhh well, when it's not one thing it's another!

By the way, i got this from the error:

Database error in vBulletin 4.0.6:

Code:
Invalid SQL:
SELECT node.nodeid, node.url, node.parentnode, node.nodeleft, node.noderight,
			node.setpublish, node.publishdate, info.title, node.permissionsfrom, node.hidden, COUNT(child.nodeid) AS children,
  			SUM(CASE WHEN (child.setpublish > 0 AND child.publishdate < 1282347755 AND child.contenttypeid <> 17) THEN 1 ELSE 0 END) AS publish_count
			FROM cms_node AS node
			LEFT JOIN cms_node AS child ON child.parentnode = node.nodeid AND child.new != 1
			LEFT JOIN cms_nodeinfo AS info ON info.nodeid = node.nodeid
			WHERE (node.contenttypeid = 17)
			GROUP BY node.nodeid, node.url, node.parentnode, node.nodeleft, node.noderight,
			node.setpublish, node.publishdate, info.title, node.permissionsfrom, node.hidden  HAVING COUNT(child.nodeid) > 0 
			ORDER by node.nodeleft;;

MySQL Error   : Got error 28 from storage engine
Error Number  : 1030
Request Date  : Saturday, August 21st 2010 @ 01:42:35 AM
Error Date    : Saturday, August 21st 2010 @ 01:42:35 AM
Script        : http://wood
Referrer      : 
IP Address    : 
Username      : woody
Classname     : vB_Database
MySQL Version : 5.0.91-community
Reply With Quote
  #145  
Old 08-21-2010, 12:39 AM
fxwoody's Avatar
fxwoody fxwoody is offline
 
Join Date: Jun 2010
Location: On Earth
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok! DO NOT RUN THE SCRIPT!!!! Server load went crazy and almost got cut off!
Reply With Quote
  #146  
Old 08-22-2010, 12:20 PM
baboo baboo is offline
 
Join Date: Aug 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi fxwoody, does is it work well with you in 406?
Reply With Quote
  #147  
Old 08-22-2010, 07:09 PM
fxwoody's Avatar
fxwoody fxwoody is offline
 
Join Date: Jun 2010
Location: On Earth
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works well in every forums with the automatic 1 st image, tho, i tried the script from megamoose and ended up with a server load that almost busted my account! So install it ok! But do not use the script! lolll

As for all the other images in the posts, only way i founded to get them to show is by edit and save each of them! Long task if you have tons of them!!! loll

Cheers
Reply With Quote
  #148  
Old 08-23-2010, 12:47 PM
baboo baboo is offline
 
Join Date: Aug 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OMG, I will pay to any one who can install it for me and make it work.

It's very important for my forum.
Reply With Quote
  #149  
Old 08-23-2010, 01:27 PM
baboo baboo is offline
 
Join Date: Aug 2007
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there someone can update it for us?
Reply With Quote
  #150  
Old 08-24-2010, 08:03 AM
S!p S!p is offline
 
Join Date: May 2010
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how to fix it?
Reply With Quote
  #151  
Old 08-24-2010, 11:59 AM
fxwoody's Avatar
fxwoody fxwoody is offline
 
Join Date: Jun 2010
Location: On Earth
Posts: 291
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you guysfallow this it should work ok for you :
https://vborg.vbsupport.ru/showpost....&postcount=145

@S!p
What version are u using and did you adjust any of the templates?
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 06:59 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.05171 seconds
  • Memory Usage 2,393KB
  • Queries Executed 28 (?)
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
  • (2)bbcode_code
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_attachment
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete