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)

megamoose 11-07-2009 05:48 PM

Yeah I did put a warning on it saying if you have a large database you may have to make an adjustment to the script to to make it stagger the results.

I didn't need to stagger it for my forum, so I just built it as one. If I get a minute I'll see if I can edit it to work for large forums.

Also, to answer your question, no you shouldn't need to change anything. It just runs off your normal settings.

Ghostt 11-07-2009 05:53 PM

ok hope you have lil time, i am excited to see it work :)

Quote:

Originally Posted by megamoose (Post 1911373)
Yeah I did put a warning on it saying if you have a large database you may have to make an adjustment to the script to to make it stagger the results.

I didn't need to stagger it for my forum, so I just built it as one. If I get a minute I'll see if I can edit it to work for large forums.

Also, to answer your question, no you shouldn't need to change anything. It just runs off your normal settings.


megamoose 11-07-2009 06:14 PM

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>


megamoose 11-07-2009 06:39 PM

Okay next fix:

If you are using the First Image in Post option, you will notice you only get a thumbnail when you update the post, and not when you create a new one. To fix this:

Goto the Manage Plugins tab in your ACP and edit New Thread - Save Thumbnail, Datamanager

You will then want to replace the Plugin PHP Code with:
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]);
                }             
                        }


Ghostt 11-07-2009 07:17 PM

cant belive that you fixed it that fast :D so happy lol big thx!!

to perfect that mod there is only one thing missing:

if you onmouseover on the Topictitle in the forumdisplay.php the thumbnail rise without to expand the "table"

maybe this helps : http://randsco.com/_miscPgs/cssZoomPZ3.html
http://www.cssplay.co.uk/menu/image_magnifier2.html

realdx 11-08-2009 05:53 PM

Installed and working! thank you!! One [REQ], kindly add "avatar of thread starter" in the next release!! BEST!

EDIT: another suggestion, if possible, store generated thumbs from user given url on forum server, once the original file is deleted, also the thumb will disappear in the thread list..(guess realtime calculated each time, slowing also down a bit the thread listing).. thanks!!

chesterano 11-09-2009 01:40 AM

if possible to able to use both the "First Attachment" and "First Image In Post" together as a option? but to display only one thumbs.

If is Attachment in post not display First Image
if is Image in post not display Attachment

tlwwolfseye 11-09-2009 08:00 AM

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>



Even with that Script I still get the same Database Error as soon as I enable this Mod. I am using vB 3.8.4 PL1.
Any idea how to use this Mod without screwing up the Forum with a DB Error ?
Thanks.

Ghostt 11-09-2009 01:38 PM

Quote:

Originally Posted by realdx (Post 1911711)
Installed and working! thank you!! One [REQ], kindly add "avatar of thread starter" in the next release!! BEST!


EDIT: another suggestion, if possible, store generated thumbs from user given url on forum server, once the original file is deleted, also the thumb will disappear in the thread list..(guess realtime calculated each time, slowing also down a bit the thread listing).. thanks!!

im versus it, 95% not need that unnecessary ballast. the performance and server load is more important to not abuse it.

realdx 11-09-2009 01:44 PM

Quote:

Originally Posted by Ghostt (Post 1911981)
im versus it, 95% not need that unnecessary ballast. the performance and server load is more important to not abuse it.

since the performance is more important is better having to load a 2kb thumbnail than load the original and then resize it in realtime everytime the thread list is viewed.. not to mention that if user grab the image for his thread from somewhere, and then that somewhere delete the image, you have the thread without any thumb.


All times are GMT. The time now is 09:35 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.01425 seconds
  • Memory Usage 1,767KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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