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)
-   -   Miscellaneous Hacks - Thread Image grabber (https://vborg.vbsupport.ru/showthread.php?t=297093)

stuie_b 04-10-2013 10:00 PM

Thread Image grabber
 
1 Attachment(s)
Thread image grabber is a request by "The Realist" it will enable you to grab all attached images from a thread and display them (as images) on a seperate page.

+ Pulls all attached images from a given thread and displays as images (not links as vb currently does)
+ Adds Link to thread tools bar (under thread tools)
+ Adds icon to forum list

Note: Please be aware although support is provided it is limited. This version is in beta so expect bugs!



As always feature requests are appreciated.

Stuie.

stuie_b 04-11-2013 08:24 PM

<font color="Red">Updated 30/05/2013</font>

1.3
+ Added support for inline/embedded images (Images which aren't attached)
+ Added support for vB 3.x.x (Tested only on vB 3.8.7 PL3)
+ Added template cache (Thanks to GENX2 for the heads up on that one)

1.2
+ Added support for vBulletin versions below 4.0.3

V1.0 First release
Nothing its the first release

The Realist 04-11-2013 08:39 PM

Well done M8 and a big thanks for this.

Regards

The Realist 04-11-2013 08:42 PM

Woooo just installed and loads of errors:

Quote:

#0 /home/*****/public_html/******/includes/adminfunctions_template.php(2842): vB_TemplateParser->validate(Array)
#1 /home/******/public_html/******/includes/adminfunctions_plugin.php(545): compile_template('{vb:stylevar ht...')
#2 /home/******/public_html/******/admincp/plugin.php(1714): install_product(' #3 {main}


Fatal error: Unable to find a class to validate: vB_TemplateParser_Curlycssfile on line 1035 in [path]/includes/class_template_parser.php in [path]/vb/vb.php on line 284
#0 vb_error_handler(256, Unable to find a class to validate: vB_TemplateParser_Curlycssfile on line 1035 in /home/******/public_html/******/includes/class_template_parser.php , /home/******/public_html/******/vb/vb.php, 284, Array ([exception] => Exception Object ([] => Unable to find a class to validate: vB_TemplateParser_Curlycssfile,[] => ,[] => 0,[] => /home/******/public_html/******/includes/class_template_parser.php,[] => 1035,[] => Array ([0] => Array ([file] => /home/******/public_html/******/includes/adminfunctions_template.php,[line] => 2842,[function] => validate,[class] => vB_TemplateParser,[type] => ->,[args] => Array ([0] => Array ())),[1] => Array ([file] => /home/******/public_html/******/includes/adminfunctions_plugin.php,[line] => 545,[function] => compile_template,[args] => Array ([0] => {vb:stylevar htmldoctype} xmlns:fb="http://www.facebook.com/2008/fbml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}"> {vb:raw headinclude} {vb:cssfile faq.css} {vb:raw headinclude_bottom} {vb:raw header} {vb:raw navbar}

{vb:raw mkio_mode}

{vb:raw mkio_mode_description}


{vb:rawphrase attached_thumbnails} {vb:rawphrase attached_files}{vb:raw mkio_threadImages}
{vb:raw footer} )),[2] => Array ([file] => /home/******/public_html/******/admincp/plugin.php,[line] => 1714,[function] => install_product,[args] => Array ([0] => Pulls all the images attached to a thread and displays them in one place 1.0 xmlns:fb="http://www.facebook.com/2008/fbml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}"> {vb:raw headinclude} {vb:cssfile faq.css} {vb:raw headinclude_bottom} {vb:raw header} {vb:raw navbar}

{vb:raw mkio_mode}

{vb:raw mkio_mode_description}


{vb:rawphrase attached_thumbnails} {vb:rawphrase attached_files}{vb:raw mkio_threadImages}
{vb:raw footer} ]]> misc_start db->escape_string($_REQUEST['thread']); if(!$threadId){ standard_error("Missing ThreadID"); } //------------------------- $qh = $vbulletin->db->query_read(" SELECT p.postid,p.threadid,a.contentid,a.attachmentid,a.f iledataid,a.filename,fd.extension,fd.dateline FROM ".TABLE_PREFIX."post AS p LEFT JOIN ".TABLE_PREFIX."attachment AS a ON (p.postid=a.contentid) LEFT JOIN ".TABLE_PREFIX."filedata as fd ON a.filedataid=fd.filedataid WHERE p.threadid='".$threadId."' AND fd.extension IN ('png', 'jpg', 'jpeg', 'gif', 'bmp')"); while($row = $vbulletin->db->fetch_array($qh)) { $html .= "options['bburl'].'/attachment.php?attachmentid='.$row['attachmentid'].'&d='.$row['dateline']."\">options['bburl'].'/attachment.php?attachmentid='.$row['attachmentid'].'&thumb=1&d='.$row['dateline']."\" alt=\"".$row['filename']."\" title=\"".$row['filename']."\"> "; } //------------------------- $navbits = construct_navbits(array('' => "Thread Images")); $navbar = render_navbar_template($navbits); $templater = vB_Template::Create('mkio_threadimg'); $templater->register_page_templates(); $templater->register('navbar', $navbar); $templater->register('mkio_mode', "View Thread Images"); $templater->register('mkio_mode_description', "View all images attached to a given thread"); $templater->register('mkio_threadImages', $html); print_output($templater->render()); }]]> showthread_start Display all images';]]> ,[1] => 0)))),[code] => 256)) called at [(null):0] #1 trigger_error(Unable to find a class to validate: vB_TemplateParser_Curlycssfile on line 1035 in /home/******/public_html/******/includes/class_template_parser.php , 256) called at [/home/******/public_html/******/vb/vb.php:284] #2 vB::handleException(Exception Object ([] => Unable to find a class to validate: vB_TemplateParser_Curlycssfile,[] => ,[] => 0,[] => /home/******/public_html/******/includes/class_template_parser.php,[] => 1035,[] => Array ([0] => Array ([file] => /home/******/public_html/******/includes/adminfunctions_template.php,[line] => 2842,[function] => validate,[class] => vB_TemplateParser,[type] => ->,[args] => Array ([0] => Array ())),[1] => Array ([file] => /home/******/public_html/******/includes/adminfunctions_plugin.php,[line] => 545,[function] => compile_template,[args] => Array ([0] => {vb:stylevar htmldoctype} xmlns:fb="http://www.facebook.com/2008/fbml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}"> {vb:raw headinclude} {vb:cssfile faq.css} {vb:raw headinclude_bottom} {vb:raw header} {vb:raw navbar}

{vb:raw mkio_mode}

stuie_b 04-11-2013 08:57 PM

Code:

Fatal error: Unable to find a class to validate: vB_TemplateParser_Curlycssfile on line 1035
That error appears to be related to vbulletin it's self and suggests an outdated version of vBulletin, Make sure your running the latest version of VB and try again.


Stuie.

GENX2 04-11-2013 11:59 PM

thanks so much.
I have note one :
there is query one

add new plugin name hook " cache_templates "
this includes :
PHP Code:

{
        
$cache[] = 'mkio_threadimg';



tpearl5 04-12-2013 09:59 AM

Curious if this will work with 4.1.12, or are those classes not available until 4.2? If not perhaps a min version check should be in order.

stuie_b 04-12-2013 03:13 PM

It appears any version before VB 4.0.3 will fail to install with the current code.

VB 4.0.2 Fails
VB 4.0.3 Fails
VB 4.0.4 Works
VB 4.0.5 Works
VB 4.0.8 Works
VB 4.1.0 Works

EDIT: Updated package to incorporate VB verions 4.0.3 and below. (import the package in the VB 4.0.0-4.0.3 folder)

Stuie.

abdobasha2004 04-12-2013 10:43 PM

2 questions :
1- Do you have a vb 3.7 version compatible?
2- Is it possible to grab images not attached, i mean not on the forum server, just the image url in the first post or so...

tpearl5 04-17-2013 04:33 PM

Quote:

Originally Posted by abdobasha2004 (Post 2415993)
2- Is it possible to grab images not attached, i mean not on the forum server, just the image url in the first post or so...

I would also like to see this. anything inside of bb img tags

Draffi 04-18-2013 05:57 PM

Works great! Good Idea, too!!!

RichieBoy67 04-26-2013 04:28 AM

Does this work with 4.2?

autoescala 04-26-2013 09:05 AM

Quote:

Originally Posted by tpearl5 (Post 2416953)
I would also like to see this. anything inside of bb img tags

+1
Nice mood, waiting for updates to try it
Regards

stuie_b 05-30-2013 12:17 PM

Apologies for the delay in replying/updates.

Quote:

Originally Posted by RichieBoy67 (Post 2418601)
Does this work with 4.2?

Yes as far as i can tell, all vB4 versions are supported.

Quote:

Originally Posted by abdobasha2004 (Post 2415993)
2 questions :
1- Do you have a vb 3.7 version compatible?
2- Is it possible to grab images not attached, i mean not on the forum server, just the image url in the first post or so...

Quote:

Originally Posted by tpearl5 (Post 2416953)
I would also like to see this. anything inside of bb img tags

V1.3 now supports the pulling of images not attached, As long as there in the form of an image url they will pulled.

vB3 should now also be supported. (Tested only on vB 3.8.7 PL3)


Stuie

tpearl5 05-30-2013 02:20 PM

Fantastic! Thanks for the update!

Some suggestions for the next version:
- link to the original post under the image
- thread title in mkio_threadimg
- link back to main thread in mkio_threadimg

tpearl5 05-30-2013 03:42 PM

Also, some minor bugs

- if there are only images referenced remotely then they will not display because of the <vb:if condition="$show['paperclip']"> around the icon.

- There is no conditional around the link in showthread - so the link shows up regardless of images or not

- If an image URL is enclosed in a url tag, the paths are wrong. Example: http://nikonites.com/misc.php?do=threadImg&thread=13010

tpearl5 05-30-2013 07:04 PM

FYI, I put this code around the images to link back to the post they are from:

Code:

<a href=\"".$vbulletin->options['bburl']."/showthread.php?t=".$row['threadid']."#post".$row['postid']."\">

tpearl5 05-30-2013 08:26 PM

Quote:

Originally Posted by tpearl5 (Post 2424967)
- If an image URL is enclosed in a url tag, the paths are wrong. Example: http://nikonites.com/misc.php?do=threadImg&thread=13010

fixed with this regex: https?:\/\/(\w|_|\.|\/)*\/[\w:]+\.(jpe?g|png|gif|bmp)

The original was matching the URL wrapped around the image

tpearl5 05-31-2013 02:36 PM

Quote:

Originally Posted by tpearl5 (Post 2424956)
- thread title in mkio_threadimg

To do this I modified the query a bit to get the title:

PHP Code:

$qh $vbulletin->db->query_read(
SELECT p.postid,p.threadid,p.title,p.parentid,p.pagetext,a.contentid,a.attachmentid,a.filedataid,a.filename,fd.extension,fd.dateline  
FROM "
.TABLE_PREFIX."post AS p  
LEFT JOIN "
.TABLE_PREFIX."attachment AS a ON (p.postid=a.contentid) 
LEFT JOIN "
.TABLE_PREFIX."filedata as fd ON a.filedataid=fd.filedataid 
WHERE p.threadid='"
.$threadId."'"); 

while(
$row $vbulletin->db->fetch_array($qh)) 

    if(
$row['parentid'] == 0
    { 
        
$title $row['title']; 
    } 

then changed the navbit to

PHP Code:

$navbits construct_navbits(array('' => "Images posted in $title")); 


M.C. 06-08-2013 10:45 AM

good hack but I can't see options for it... how to disable inline images (external) and show only attached? also would be nice to disable it in some forums and have user permissions as well...

another thing - I see if picture exist on X pages it getting multiplied by X on View Thread Images page, so if I have same image in 10 pages - it shows 10 times there!

Thanks! ;)

kingMOB 09-27-2013 08:16 PM

Nice plugin, thanks =)

Is there a way to split the result in different pages?


All times are GMT. The time now is 09:48 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.01229 seconds
  • Memory Usage 1,803KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete