vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Forum Display Enhancements - Thread Thumbnails (https://vborg.vbsupport.ru/showthread.php?t=237404)

Null Parameter 03-02-2010 10:00 PM

Thread Thumbnails
 
1 Attachment(s)
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 (Post 1911383)
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!

Aclikyano 03-03-2010 05:37 PM

thanks ill check it out! :)

Aceman 03-03-2010 05:41 PM

not first.. but AWESOME!

Xtrigit 03-03-2010 06:06 PM

OMG!!!!!!! Thank you so much! This is the ONLY MOD that made me downgrade to 3.8.4. I will test it later this week and see how it goes.

kalisekj 03-03-2010 06:43 PM

Awesome A Must Have for me and most of my sites. Thank You! Now To Pray it works.

kalisekj 03-03-2010 07:04 PM

OK First Bug as I can see now, I changed to before thread icon and now have 2 pics on the forum display page 1 before thread icon and 1 after thread icon. LOL

VBoptimize Users You Must Disable Cache Styles (Set It To No) then the thumbnails will work as needed. Also You need to Disable vB Optimise: Cache Templates so that you do not get multiple Thumbnails on Forum Thread Display. This is just a small part of vboptimize that is well worth turning off to get thumbnails to work.

Null Parameter 03-03-2010 07:11 PM

Quote:

Originally Posted by kalisekj (Post 1996323)
OK First Bug as I can see now, I changed to before thread icon and now have 2 pics on the forum display page 1 before thread icon and 1 after thread icon. LOL

VBoptimize Users You Must Disable Cache Styles (Set It To No) then the thumbnails will work as needed. This is just a small part of vboptimize that is well worth turning off to get thumbnails to work.

LOL, I was just about to post that when you edited it in. vB Optimize goes behind vB's caching and caches the templates on it's own. This leads to cached templates receiving multiple edits when switching between Before/After Thread Icon.

akvaryumforum 03-03-2010 07:11 PM

No Thumb selection not work. I just links to /attachment.php?attachmentid=&stc=1&thumb=1 al no thumbs.

Null Parameter 03-03-2010 07:16 PM

Quote:

Originally Posted by akvaryumforum (Post 1996332)
No Thumb selection not work. I just links to /attachment.php?attachmentid=&stc=1&thumb=1 al no thumbs.

Ahh, nice catch. I have a separate code path for the attachments part. I'll add that in right away.

Deceptor 03-03-2010 07:17 PM

Quote:

Originally Posted by Null Parameter (Post 1996330)
LOL, I was just about to post that when you edited it in. vB Optimize goes behind vB's caching and caches the templates on it's own. This leads to cached templates receiving multiple edits when switching between Before/After Thread Icon.

Anything I can do to resolve that? :)

Null Parameter 03-03-2010 07:27 PM

Quote:

Originally Posted by Null Parameter (Post 1996336)
Ahh, nice catch. I have a separate code path for the attachments part. I'll add that in right away.

I uploaded a new version with this change. Go try it now, the First Attachment + No Thumbnail Image combo should work now.

Quote:

Originally Posted by Deceptor (Post 1996337)
Anything I can do to resolve that? :)

I'm not really sure, because I have no idea how vB Optimize works. :)
I was basing that answer/guess solely on the description of the mod. It really depends upon when and how the template caching is done vs how and when I do the auto-edits.

akvaryumforum 03-03-2010 07:29 PM

The problem solved, now it's workin like a charm for me. :)

Null Parameter 03-03-2010 07:33 PM

Quote:

Originally Posted by akvaryumforum (Post 1996345)
The problem solved, now it's workin like a charm for me. :)

Good to hear! Let me know if you see anything else.

kalisekj 03-03-2010 07:45 PM

deceptor read my thread above It tells what options to turn off in vboptimize to get the thumbnails to show properly.

Deceptor 03-03-2010 07:57 PM

Quote:

Originally Posted by Null Parameter (Post 1996343)
I uploaded a new version with this change. Go try it now, the First Attachment + No Thumbnail Image combo should work now.


I'm not really sure, because I have no idea how vB Optimize works. :)
I was basing that answer/guess solely on the description of the mod. It really depends upon when and how the template caching is done vs how and when I do the auto-edits.

The cache doesn't intrude really, it basically stops vBulletin from querying templates. The templates are still placed in the array as they normally would.

Null Parameter 03-03-2010 08:03 PM

Quote:

Originally Posted by Deceptor (Post 1996366)
The cache doesn't intrude really, it basically stops vBulletin from querying templates. The templates are still placed in the array as they normally would.

The issue is that the auto-template edits edited the cached template, then the options changed to make the edit in a different place in the template. Instead of the second edit replacing the first one, they both remained intact.

Null Parameter 03-03-2010 08:04 PM

Quote:

Originally Posted by kalisekj (Post 1996355)
deceptor read my thread above It tells what options to turn off in vboptimize to get the thumbnails to show properly.

He's the Developer of vB Optimize, that's why he asked if he could help ;)

kalisekj 03-03-2010 08:15 PM

Quote:

Originally Posted by Null Parameter (Post 1996377)
He's the Developer of vB Optimize, that's why he asked if he could help ;)

I thought his name looked familiar. I hope between the 2 of you something can be resolved so I can turn those 2 features back on in vboptimize. WooHoo!

Aceman 03-03-2010 08:19 PM

Is there a way to turn OFF thread icons if a threads thumbnails are showing (auto template edits on)? If not it would be a great option. I suppose I could just edit the template.

akvaryumforum 03-03-2010 08:22 PM

Is it possible to add function like this zoom?

http://www.simplebits.com/bits/photo_zoom.html

Null Parameter 03-03-2010 08:27 PM

Quote:

Originally Posted by Aceman (Post 1996387)
Is there a way to turn OFF thread icons if a threads thumbnails are showing (auto template edits on)? If not it would be a great option. I suppose I could just edit the template.

Theoretically, I could probably do that.
Maybe make a third Location option, "Replace Threadicon".

Null Parameter 03-03-2010 08:31 PM

Quote:

Originally Posted by akvaryumforum (Post 1996389)
Is it possible to add function like this zoom?

http://www.simplebits.com/bits/photo_zoom.html

That's been talked about before. It's a definite possibility, if I can find a good way to do it with straight CSS, then I might add it in.

Deceptor 03-04-2010 12:46 AM

Quote:

Originally Posted by Null Parameter (Post 1996375)
The issue is that the auto-template edits edited the cached template, then the options changed to make the edit in a different place in the template. Instead of the second edit replacing the first one, they both remained intact.

I'll look into your mod here and see what can be done :)

Null Parameter 03-04-2010 12:58 AM

Quote:

Originally Posted by Dr.osamA (Post 1996435)
2- old thread steel without thumb ... can you make something like SQL order to fix all threads plzz?

I'm not sure that I understand the problem. Could you please explain it in more detail?

Quote:

Originally Posted by Dr.osamA (Post 1996449)
ahhhha

for 1st bug

fix:

find template thread_thumbnail_threadbit
delete all entries and pest this code:

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:right;clear:left;display:block;"><img style="{vb:raw thread.thumbnailstyle}" src="{vb:raw thread.thumbnailurl}"></a>
        </
vb:if> 

this is for forums using lan. Righit to left as Arabic

plzz Null Parameter can i translate the mod to Arabic and add it here ?? your permission plzz

Thanks for finding the fix to that. I'm adding a RTL version of the product XML file to the thread.

Yes, you may translate it and I can edit that into the thread as well.

Null Parameter 03-04-2010 01:04 AM

Quote:

Originally Posted by Deceptor (Post 1996531)
I'll look into your mod here and see what can be done :)

Thanks. Theoretically it shouldn't be too big of an issue, so don't beat yourself up about it. It should only happen when switching that one particular option, and most people choose one and let it be. I think a workaround might be that, when you change the option, you disable the template caching in vB Optimize, load the forumdisplay once and then re-enable it.

Greight 03-04-2010 04:27 AM

Can the "user avatar" be placed as the thumbnail in some way?

ThomasR 03-04-2010 05:53 AM

Thanks a lot of this plugin and all the improvment you did (ACP, thumbnail URL, etc...)
Now, I can switch my forum to vb4! :)

Null Parameter 03-04-2010 02:09 PM

Quote:

Originally Posted by Dr.osamA (Post 1996963)
i meant how i can add Thumbnails to all old threads as in one click no one by one
Proposal = you can make SQL order to make this changes

There's a script that another member wrote in the FAQs section of the thread to help with this.

I'll add the translated version to the thread.

Mike_K 03-04-2010 05:06 PM

Perfect... and nominated!

shooptek 03-05-2010 11:56 PM

This is awesome, but I wish there was a way to separate the titles of the thread and the information about it a few pixels away from the thumbnail, as it looks a bit akward. Any clues?

Null Parameter 03-06-2010 12:06 AM

Quote:

Originally Posted by shooptek (Post 1998122)
This is awesome, but I wish there was a way to separate the titles of the thread and the information about it a few pixels away from the thumbnail, as it looks a bit akward. Any clues?

Yep! Use the Thumbnail Style field and add a margin on the thumbnails.

For instance, if you wanted to have your thumbnails be spaced 3 pixels away from the title, you could use:

margin-right:3px;

shooptek 03-06-2010 12:15 AM

Perfect. Thanks for the help!

matthieugoua 03-06-2010 11:26 AM

Thank you for this mod, I'd love to know if it was possible to add a mod this system to scroll past the thumbnails in the forumhome

Sorry for my bad english i am french

Null Parameter 03-06-2010 08:05 PM

Quote:

Originally Posted by matthieugoua (Post 1998392)
Thank you for this mod, I'd love to know if it was possible to add a mod this system to scroll past the thumbnails in the forumhome

Sorry for my bad english i am french

Yes, it would definitely be possible. I'm not sure if I would take the time to make one myself, but just in case, could you find an example somewhere of what you mean by "scroll past the thumbnails", so I know exactly what you mean.

phkk 03-06-2010 08:42 PM

Do they have VBoptimize for Vbullet 4?

phkk 03-06-2010 09:23 PM

Please show me the script or sql command to add by 1 click

)i can add Thumbnails to all old threads as in one click )

Null Parameter 03-06-2010 10:50 PM

Quote:

Originally Posted by phkk (Post 1998717)
Do they have VBoptimize for Vbullet 4?

Yes, just do a search for it.

Quote:

Originally Posted by phkk (Post 1998737)
Please show me the script or sql command to add by 1 click

)i can add Thumbnails to all old threads as in one click )

Read the first post, it's right in there.

phkk 03-07-2010 12:03 AM

I don't want to manually click to continue. Do you have something AUTOMATIC Process to the next page

Kreyg 03-07-2010 11:02 AM

I had a question about this. I encourage my users who like to keep up on the new posts to use our "whats new" tab. is there anyway that the thumbnails can be added to that page as well? Is this at all possible?

Greight 03-07-2010 04:35 PM

Quote:

Originally Posted by Greight (Post 1996640)
Can the "user avatar" be placed as the thumbnail in some way?

Possible?


All times are GMT. The time now is 02:17 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01686 seconds
  • Memory Usage 1,864KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (23)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete