vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   New Posting Features - Thread Thumbnails (https://vborg.vbsupport.ru/showthread.php?t=214755)

Cerbero1000 03-31-2010 10:19 AM

Solved. All works perfectly!

matthewhotdude 03-31-2010 12:32 PM

Installed, but no thumbnails are showing up.

Ok sorted that out, had to add the width manually.

But is there a way to update all old threads so the thumbnails show up?

Null Parameter 03-31-2010 01:35 PM

Quote:

Originally Posted by matthewhotdude (Post 2013412)
Installed, but no thumbnails are showing up.

Ok sorted that out, had to add the width manually.

But is there a way to update all old threads so the thumbnails show up?

I haven't tested this, but others have used it successfully.


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>



Null Parameter 03-31-2010 01:37 PM

Quote:

Originally Posted by Cerbero1000 (Post 2013370)
Solved. All works perfectly!

Good to hear! What did you have to do?

Also, I forgot that I fixed and uploaded a new version where thumbnails should work correctly. Not sure how I forgot that.... :cool:

matthewhotdude 03-31-2010 01:42 PM

Quote:

Originally Posted by Null Parameter (Post 2013446)
I haven't tested this, but others have used it successfully.

Where do I do that?

Sorted!

Thanks great mod works perfect

Null Parameter 03-31-2010 03:13 PM

Quote:

Originally Posted by matthewhotdude (Post 2013452)
Where do I do that?

Sorted!

Thanks great mod works perfect

Great!

siliconfinance 04-03-2010 06:45 AM

Quote:

Originally Posted by Null Parameter (Post 1997777)
That is currently an option in the vB4 version, but not in this one. If there's demand for it, I could probably port that functionality back here as well.

:up:^Pie^3

If you did it, it would make a lot of people :D

Cybershaolin 04-04-2010 07:51 PM

1 Attachment(s)
Very nice hack but I have a problem with it. I use "First Attachment as the option for displaying the thumbnail but whenever the user does not have any attachments in the thread, nothing shows in the forum column. No thread icon or no "Nothumb.jpg" image even if I have define to use one image if there is none uploaded by the user. The path for nothumb.jpg is correct.

The result is not really nice since it only shows thumbnails for users who have attachments and it shows empty spots everywhere else. So, all the thread icons have disapeared and/or no "Nothumb.jpg" image is showing. I used to have what you see on the first picture but now I have what you see on the second picture.

Why is it doing that and am I the only one for which this is happening?

I chose automatic template edits in the options but, if I decide to choose to do manual edits for the templates, where are they? There is nothing in the readme talking about manual template edits besides those if you upgrade from a previous version.

Cybershaolin 04-06-2010 02:56 AM

I found out what's happening:

1- If you use the option "First Attachment: If the user adds an attachment to the thread, the first image attachment will be used as the thumbnail."
- The thumbnail is diplayed correctly as shown in my previous post in the attached screenshots.
- There is nothing else shown if no attachment is present, No "Nothumb.jpg" picture or no thread icon, just a blank space, again, as shown in my previous post in the attached screenshots.

2- If you use the option "First Image In Post: If the user adds an image into their post, via [IMG] tags, then the first image in the post will be used as the thumbnail."
- The thumbnail is diplayed correctly in the forum.
- If no attachment is present, then the picture "Nothumb.jpg" picture displays correctly if we choose to display it or the thread icon also displays correctly if this option is retained.

Therefore, for me, only the option "First image in Post" works correctly for the thread icon or the "Nothumb.jpg" picture to appear when there is no IMG tag in the post.

The problem is that I don't want to use this option or the URL option either. I want to use the option "First Attachment"! So is there a fix for this? And finally, is it possible to get the template manual edits?

Cybershaolin 04-09-2010 06:16 PM

That would be nice to get some kind of answer on the bug I'm experimenting.


All times are GMT. The time now is 10:45 AM.

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.01811 seconds
  • Memory Usage 1,751KB
  • 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
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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