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)
-   -   Add-On Releases - Display all images and files in Print Thread (https://vborg.vbsupport.ru/showthread.php?t=319875)

Elite_360_ 08-13-2015 09:00 PM

Display all images and files in Print Thread
 
1 Attachment(s)
Mark As Installed = Support

For Version Information: Go to Post #2


Description: This Mod will show all Images and files in Print Thread.

Installation:

1. Import the product-e360_printthreadimg.xml product file via AdminCP > Plugin System > Manage Products > [Add/Import Product]

2. Go To AdminCP > Settings > Options > e360 - Forums Online CountUp Options/ And config

-

Elite_360_ 08-14-2015 08:56 PM

Version Information:

1.0.0 - Aug 14 2015
-First version

1.0.1 - Aug 14 2015
-Improve code.

1.0.2 - Aug 19 2015
-Fixed a Bug That @Wedframe Pointed Out With His Code.

1.0.3 - Sep 2 2015
-Fixed a bug "It now checks image type".
-Added bmp and jpe image types.
-Added non image attachments to "Print Thread".

1.0.4 - Sep 2 2015
-Added back the code i accidentally removed in 1.0.3 that converts embedded images.

--

Wedframe 08-19-2015 05:56 PM

Elite_360_, if in post I have link to full image with built-in thumbnail, like this:
[yrl=httр://someserver.net/0000000.htm][iмg]httр://someserver.net/0000000m.jpg[/iмg][/yrl]
then regexp work not correctly. And as a result, I have in post follow html:
HTML Code:

<div class="content"><img src="http://savepic.net/7168271.htm" target="_blank"><a href="http://savepic.net/7168271m.jpg" style="max-width: 100%;max-height: 100%;padding: 2px;"></a></div>
and of couse its give me wrong result:
http://savepic.su/6054179m.jpg

I use next code for replace embeded Images:
PHP Code:

$post['message'] = preg_replace (  
        
'/<a href="([^"]+)\.(gif|png|jpg|jpeg)"([^>]*)>([^<]+)<\/a>/i',  
        
'<img src="\\1.\\2" alt="\\4" />',  
        
$post['message']  
    ); 

It`s work fine with attachments and with regular images.

Elite_360_ 08-19-2015 08:17 PM

Added your code to 1.0.2 i was getting the same error if you make a image as a link.

Wedframe 09-01-2015 11:15 PM

Elite_360_, one more problem what I found.
If inline attachment is NOT image, then again will be error 404 to this "image"(like on above screenshot). So... I made hybrid code from your, from vB and from my own code... what first check the extension of attachment:
PHP Code:

if ($post['attach'] > 0)
    {
        
$attachments $vbulletin->db->query_read("SELECT attachmentid, filename
                FROM " 
TABLE_PREFIX "attachment
                WHERE `contenttypeid` = 1 AND `userid` = " 
$post['userid'] . "
                AND `state` = 'visible' AND `contentid` = " 
$post['postid'] . "
        "
);

        
        while (
$attachments_info $vbulletin->db->fetch_array($attachments))
        {
            
$filename strtolower($attachments_info['filename']);
            
$extension substr(strrchr($filename'.'), 1);
            
$extensions = array("jpg""jpeg""png""gif");
            if (!
in_array($extension$extensions))
            {
                continue;
            }
            
//Generate images instead links to inline attachment images
            
$post['attach'] = 0
            
$post['message'] = preg_replace("/<a href=\"(\w{4,5}:\/\/.*attachmentid\=" .$attachments_info['attachmentid']. ")\"\s(.|\n)*<\/a>/U""<img style=\"max-width:" .$vbulletin->options['adv_printthread_images_size']. "; max-height:" .$vbulletin->options['adv_printthread_images_size']. ";" .$vbulletin->options['adv_printthread_images_style']. "\" src=\"\\1\">"$post['message']);
            
        }
    
    } 

And.... I release new mod with some more functionality(and it will be still more with time):
https://vborg.vbsupport.ru/showthrea...78#post2554078
I hope its not bad idea?

Elite_360_ 09-02-2015 07:46 PM

Quote:

Originally Posted by Wedframe (Post 2554080)

Go ahead just don't take any more code from future releases of this mod. Thanks for pointing out that it's not checking attachment types.

Elite_360_ 09-02-2015 08:55 PM

Updated to 1.0.3
-Fixed a bug "It now checks image type".
-Added bmp and jpe image types.
-Added non image attachments to "Print Thread".

Elite_360_ 09-03-2015 12:59 AM

Update to 1.0.4
-Added back the code i accidentally removed in 1.0.3 that converts embedded images.


All times are GMT. The time now is 07:00 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.01302 seconds
  • Memory Usage 1,750KB
  • 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_html_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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