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)

Ghostt 10-25-2009 12:27 PM

Quote:

Originally Posted by aztecboi2003 (Post 1905800)
I don't have the same bug as you Ghostt. But I did notice it gave me 2 Thumbnail URL boxes now.

the thumbnail thing is working but completly useless for me i am speaking about the autiomatic first image option.... it still dont show the thumbnail only after updateing(editing) the post...

Sayid 10-26-2009 11:03 AM

Oh yes and finally I can see the mod updated

nominate and will try it on weakend ;)

Thanks Null

Ghostt 10-26-2009 07:53 PM

Quote:

Originally Posted by Ghostt (Post 1905793)
ok ive tested the mod today. following bug: The first image is only showing if i make a Topic and after that i have to edit that the image is shown.. do you have the same bug? ive tested it with manuel template change and with automatic
best regards

Do anyone have the same bug?

marianoblesa 10-26-2009 08:13 PM

Ami same thing happens to me until I edit the theme is not agego the image of the first pos

Chadi 10-26-2009 08:34 PM

1 Attachment(s)
Thumbnails not working on sticky threads and I do have the option enabled and have img file paths/url applied to each thread.

Did manual template edits as well.

Null Parameter 10-27-2009 04:47 PM

Odd, I wasn't getting emails from replies, so now I have a lot to respond to. Sorry for the delay!

Quote:

Originally Posted by aztecboi2003 (Post 1905792)
I upgraded and everything went smooth. But after I switched from URL to first attachment I got a database error. I switched back to URL and my site was fine again. I didn't look to see what the eror was though. I can try and recreate it if you want me too.

The Attachment Option has some known bugs, but I've never seen a database error. If you want to recreate and PM me the error, along with your vBulletin version, that would be great.

Quote:

Originally Posted by Ghostt (Post 1905793)
ok ive tested the mod today. following bug: The first image is only showing if i make a Topic and after that i have to edit that the image is shown.. do you have the same bug? ive tested it with manuel template change and with automatic
best regards

I'll take a look into this, but it had been working for me.

Quote:

Originally Posted by aztecboi2003 (Post 1905800)
I don't have the same bug as you Ghostt. But I did notice it gave me 2 Thumbnail URL boxes now.

The only reason I can think of for this is if you had done the manual edits for v1 and then added in v2. Or possibly, if you have edited your templates, you might have two instances of the string that is being searched for to do the auto-template edits.

Quote:

Originally Posted by Chadi (Post 1906607)
Thumbnails not working on sticky threads and I do have the option enabled and have img file paths/url applied to each thread.

Did manual template edits as well.

I'll look at this as well, but again, it had been working for me.

Quote:

Originally Posted by marianoblesa (Post 1906591)
Ami same thing happens to me until I edit the theme is not agego the image of the first pos

Not sure I understand the issue.

Null Parameter 10-27-2009 04:57 PM

Quote:

Originally Posted by BlessedLAF (Post 1905083)
Hmmmmm, it won't let me change the image once I put the original URL in. I have no clue what I am doing wrong.

EDIT: OK, I tried it again and it won't let me change it. :( It shows the original image and then when I edit it again it also shows the original URL. I would so love to get this to work...just not sure what I did wrong. Any help would be much appreciated.

This could be an issue with the Auto-template edits. If you want to PM me your editpost template, I can take a look to see if it should be working.

Quote:

Originally Posted by marianoblesa (Post 1905765)
Hello, install this hack and it works very well.

Just wanted to make a query you could suggest how I might do to the subjects who are already echos and I state x forum as it should do to make me appear.
Since I only put them in the new issues

the option that I would like to use is that of the first image of the item.

Greetings.

Actually, I think I just figured out the issue people are seeing with the First Image Setting.

The issue is that, to save on processing, I only update the thumbnail when a thread is edited or created, therefore if you have a forum full of threads, none of them will have the thumbnail saved. So, if you go back and edit the first post of a thread, the thumbnail should update and work.

Obviously, this is a bad workaround, because if you have 5k threads, you'll have to edit 5k posts to get all of the thumbnails to work, but it should still work while I think of a good way to automatically update threads when a forum is added/removed from the list.

Quote:

Originally Posted by Sayid (Post 1906368)
Oh yes and finally I can see the mod updated

nominate and will try it on weakend ;)

Thanks Null

You are welcome.

Quote:

Originally Posted by Canadians360 (Post 1905721)
Hey Null the new update is great, I thought I might pitch in a few ideas myself

*Option to set thumbnails as a required field when thumbnails are enabled
*Prioritize the three forms of thumbnail fetching (ex: if I am a thumbnail forum and a thumbnail url was not given use the first image)
*Dont show thumbnails on closed threads

Those are the only three I have right now, Ill let you know if any more decent ideas cross my mind.

Thanks for the suggestions. I had the Priority planned before, I think it's listed in rough form on like the first page of this thread, but it adds a lot of complexity and with people wanting updates, I skipped it for the time being. And I'm not exactly sure how I'd make it a required field..... I'll have to look into that one.

elenh 10-27-2009 05:39 PM

Works not for me.
The sticky threads is on but nothing showing and the rest thumbs is showing the "no image avaible" thumb.

The fuction of Thumbnail Source is: First image in post. but no images getting.

Null Parameter 10-27-2009 05:44 PM

Quote:

Originally Posted by elenh (Post 1907043)
Works not for me.
The sticky threads is on but nothing showing and the rest thumbs is showing the "no image avaible" thumb.

The fuction of Thumbnail Source is: First image in post. but no images getting.

Like I said above, I already figured out the issue here.....

Quote:

Originally Posted by Null Parameter (Post 1907014)
Actually, I think I just figured out the issue people are seeing with the First Image Setting.

The issue is that, to save on processing, I only update the thumbnail when a thread is edited or created, therefore if you have a forum full of threads, none of them will have the thumbnail saved. So, if you go back and edit the first post of a thread, the thumbnail should update and work.

Obviously, this is a bad workaround, because if you have 5k threads, you'll have to edit 5k posts to get all of the thumbnails to work, but it should still work while I think of a good way to automatically update threads when a forum is added/removed from the list.


Lietha 10-28-2009 10:28 AM

Have just installed the mod and much easier to use. However, if I set Thumbnail Source to "First Image In Post" I get the follwoing SQL error

Code:

Database error in vBulletin 3.8.4:

Invalid SQL:

                SELECT
                        IF(votenum >= 1, votenum, 0) AS votenum,
                        IF(votenum >= 1 AND votenum > 0, votetotal / votenum, 0) AS voteavg,
                post.pagetext AS preview,
                        thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, postusername, postuserid, thread.iconid AS threadiconid,
                        thread.dateline, notes, thread.visible, sticky, votetotal, thread.attach, thread.lastpost, thread.lastposter, thread.lastpostid, thread.replycount, IF(thread.views<=thread.replycount, thread.replycount+1, thread.views) AS views,
                        thread.prefixid, thread.taglist, hiddencount, deletedcount
                        , NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed
                        , deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason
                       
                        , threadredirect.expires
                        , attachment.thumbnail_filesize AS thumbsize , MIN(attachment.attachmentid) AS attachmentid , MIN(attachment.attachmentid) AS attachmentid
                FROM dudbthread AS thread
                        LEFT JOIN dudbdeletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND deletionlog.type = 'thread')
                        LEFT JOIN dudbsubscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = 1 AND canview = 1)
                       
                        LEFT JOIN dudbpost AS post ON(post.postid = thread.firstpostid)
                       
                        LEFT JOIN dudbthreadredirect AS threadredirect ON(thread.open = 10 AND thread.threadid = threadredirect.threadid)
                        LEFT JOIN dudbattachment as attachment ON(attachment.postid = thread.firstpostid AND (attachment.extension = 'jpg' OR attachment.extension = 'gif' OR attachment.extension = 'png')) LEFT JOIN dudbattachment AS attachment ON (attachment.postid = thread.firstpostid AND attachment.extension IN('jpg', 'gif', 'png', 'jpeg', 'bmp'))
                WHERE thread.threadid IN (0,19,18,10,8) GROUP BY thread.threadid
                ORDER BY sticky DESC, lastpost DESC;

MySQL Error  : Not unique table/alias: 'attachment'
Error Number  : 1066
Request Date  : Wednesday, October 28th 2009 @ 11:28:21 AM
Error Date    : Wednesday, October 28th 2009 @ 11:28:21 AM
Script        : http://www.3d-underground.com/forums/forumdisplay.php?f=4
Referrer      : http://www.3d-underground.com/forums/
IP Address    : 160.79.38.70
Username      : SnowCrash
Classname    : vB_Database
MySQL Version : 5.0.82-community


Lietha 10-28-2009 02:13 PM

Sorry - just realised that should be "First attachment in post". Sorry about that.

Ghostt 10-28-2009 05:01 PM

Quote:

Originally Posted by Null Parameter (Post 1907014)
Actually, I think I just figured out the issue people are seeing with the First Image Setting.

The issue is that, to save on processing, I only update the thumbnail when a thread is edited or created, therefore if you have a forum full of threads, none of them will have the thumbnail saved. So, if you go back and edit the first post of a thread, the thumbnail should update and work.

Obviously, this is a bad workaround, because if you have 5k threads, you'll have to edit 5k posts to get all of the thumbnails to work, but it should still work while I think of a good way to automatically update threads when a forum is added/removed from the list.

Yes how i told. this first image option is useless without a fix because to open a post and then have to edit them everytime is just stupid and no user know/understand that...
you are right we have 40k Topics and cant edit them manuell. I very hope you can fix it!
but still good work and good support !!

Null Parameter 10-29-2009 12:51 AM

Quote:

Originally Posted by Lietha (Post 1907400)
Sorry - just realised that should be "First attachment in post". Sorry about that.

Yep, I was going to say that the SQL was for the attachment. Hmmm..... Must be a different version of SQL that doesn't allow like named items, I'll look into changing that as well.

Quote:

Originally Posted by Ghostt (Post 1907465)
Yes how i told. this first image option is useless without a fix because to open a post and then have to edit them everytime is just stupid and no user know/understand that...
you are right we have 40k Topics and cant edit them manuell. I very hope you can fix it!
but still good work and good support !!

I'm looking into a way to do an update to all of the threads in a forum when a forum is added to the list.

christian8a 10-29-2009 08:15 AM

Tried it and Didn't work :down:

Ghostt 10-29-2009 11:31 AM

Quote:

Originally Posted by Null Parameter (Post 1907634)

I'm looking into a way to do an update to all of the threads in a forum when a forum is added to the list.

Thats good , but it should not make mutch load. it looks like it would do :/

why it isnt showing imdiatly ? it is a direct link parse to the image , or not . like $thumburl or so....

Lulubelle 10-29-2009 02:37 PM

Hey :)

Any luck working out why all the threads disappear apart from the first one when using the 'first attachment in post' option?

Really want to get this working on my forum.

Thanks :)

Ghostt 10-30-2009 09:04 PM

Quote:

Originally Posted by dai-kun (Post 1904007)
You can get the full image to show when your hover over it by:

Edit MAIN CSS of style, at the bottom ADDITIONAL CSS DEFINITIONS (1st or 2nd box depending on how you use it), add in (or edit to your preference)


Do the following template edits:
threadbit
Find
PHP Code:

<a href="showthread.php?$session[sessionurl]t=$thread[threadid]"

Replace with
PHP Code:

<class="thumbnail" href="showthread.php?$session[sessionurl]t=$thread[threadid]"


very good idea! but isnt working for me .
nothing is changing also after style cache deletion.

elenh 10-30-2009 09:11 PM

Great thank you!

Voonyx 10-30-2009 10:01 PM

Is it possible, to show the Thumbnail URL Input field for admins only ?

ToniKa 10-31-2009 02:21 PM

Thx, Null Parameter!
That would be fantastic :up:

Will be released Thread Thumbnails version for Vbulletin 4?

Ghostt 11-02-2009 12:40 PM

Is a fix for the First Image in topic in sight? I realy need it

eak 11-02-2009 01:14 PM

Quote:

Originally Posted by Ghostt (Post 1909394)
Is a fix for the First Image in topic in sight? I realy need it

me too.

1320Nation 11-02-2009 02:07 PM

After updating the mod to the current version, I get the following database error when selecting the "First Attachment" option in the Thumbnail Source part of the mod. The "User Entered URL" and "First Image In Post" options both appear to be working with no problems.

I hope a fix can be found for this error.

PHP Code:

Database error in vBulletin 3.7.3:

Invalid SQL:

        
SELECT 
            
IF(votenum >= 1votenum0) AS votenum,
            IF(
votenum >= AND votenum 0votetotal votenum0) AS voteavg,
         
post.pagetext AS preview,
            
thread.threadidthread.title AS threadtitlethread.forumidpollidopenpostusernamepostuseridthread.iconid AS threadiconid,
            
thread.datelinenotesthread.visiblestickyvotetotalthread.attachthread.lastpostthread.lastposterthread.lastpostidreplycount, IF(views<=replycountreplycount+1views) AS views,
            
thread.prefixidthread.taglisthiddencountdeletedcount
            
            
deletionlog.userid AS del_useriddeletionlog.username AS del_usernamedeletionlog.reason AS del_reason
            
            
threadredirect.expires
            
hasannuser.displaygroupid AS hasanndisplaygidhasannuser.usergroupid AS hasannusergidhuseyinuser.displaygroupid AS huseyindisplaygidhuseyinuser.usergroupid AS huseyinusergidMIN(attachment.attachmentid) AS attachmentid
        FROM board_thread 
AS thread
            LEFT JOIN board_deletionlog 
AS deletionlog ON(thread.threadid deletionlog.primaryid AND deletionlog.type 'thread')
            
            
            
LEFT JOIN board_post AS post ON(post.postid thread.firstpostid)
            
            
LEFT JOIN board_threadredirect AS threadredirect ON(thread.open 10 AND thread.threadid threadredirect.threadid)
                        
LEFT JOIN board_user AS hasannuser ON (thread.lastposter hasannuser.username)
            
LEFT JOIN board_user AS huseyinuser ON (thread.postuserid huseyinuser.userid)LEFT JOIN board_attachment AS attachment ON (attachment.postid thread.firstpostid AND attachment.extension IN('jpg''gif''png''jpeg''bmp'))
        
WHERE thread.threadid IN (0,33703,33677,33670,33669,33646,33625,33624,33612,33611,33609,33597,33594,33590,33578,33570,33569,33565,33552,33540,33530,33529,33516,33499,33498,33487,33484,33471,25660,25688,25725,25655,25945
        
ORDER BY sticky DESClastpost DESC;

MySQL Error   Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
Error Number  
1140
Request Date  
MondayNovember 2nd 2009 10:56:21 AM
Error Date    
MondayNovember 2nd 2009 10:56:22 AM
Script        
http://www.******.com/forums/forumdisplay.php?f=80
Referrer      http://www.******.com/forums/index.php
IP Address    98.***.***.***
Username      : *** ***
Classname     vB_Database
MySQL Version 
5.0.45 


Ghostt 11-02-2009 02:12 PM

Quote:

Originally Posted by psychobike (Post 1909422)
"First Image In Post" options both appear to be working with no problems.

youre wrong "First Image In Post" isnt working how it should! (image isnt shown after posting)

1320Nation 11-02-2009 02:54 PM

Quote:

Originally Posted by Ghostt (Post 1909426)
youre wrong "First Image In Post" isnt working how it should! (image isnt shown after posting)

If I use the img tags in the first post in the thread, it works on my board.

Once the "First Attachment" is working properly I would like to able to use both the "First Attachment" and "First Image In Post" together as a option. Hopefully Null Parameter will stay on top of this and get it taken care of asap.

Ghostt 11-02-2009 03:08 PM

Quote:

Originally Posted by psychobike (Post 1909435)
If I use the img tags in the first post in the thread, it works on my board.

Once the "First Attachment" is working properly I would like to able to use both the "First Attachment" and "First Image In Post" together as a option. Hopefully Null Parameter will stay on top of this and get it taken care of asap.

realy working without need to edit the post?? maybe youve had an older version of thumbmod befor ... give me please your boardurl with pn or post it here . i want to test it.

1320Nation 11-02-2009 03:19 PM

Quote:

Originally Posted by Ghostt (Post 1909442)
realy working without need to edit the post?? maybe youve had an older version of thumbmod befor ... give me please your boardurl with pn or post it here . i want to test it.

You are right. I have to edit the post in order for it to appear.

BlessedFWI 11-04-2009 07:26 AM

Quote:

Originally Posted by Null Parameter (Post 1907014)
This could be an issue with the Auto-template edits. If you want to PM me your editpost template, I can take a look to see if it should be working

Thanks...I will PM you now!

megamoose 11-07-2009 08:26 AM

You can use this to update all previously posted threads using First IMG in post

Upload it to your server root as something like xupdater.php and run.

Then DELETE it.

Code:

// SEE REVISED SCRIPT BELOW

Ghostt 11-07-2009 11:13 AM

Thanks for your work , but im getting an error while running the file "Database error".
and i think it isnt a permanently solution ,which causes an extream amount of server LOAD.

did you tested it? do i have to modifiy something? (my sqltable prefix is "vb")
Quote:

Originally Posted by megamoose (Post 1911256)
You can use this to update all previously posted threads using First IMG in post

Upload it to your server root as something like xupdater.php and run.

Then DELETE it.

WARNING! For large forums it may take some time to run the script, and if you have a max exec time then you may have to add breaks in it.

Code:

<?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');

$threads = $db->query_read_slave("SELECT * FROM thread");

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

    $posts = $db->query_read_slave("SELECT * FROM `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 `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);

}
?>



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 03:57 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.01873 seconds
  • Memory Usage 1,961KB
  • 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
  • (6)bbcode_code_printable
  • (3)bbcode_php_printable
  • (29)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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