View Full Version : Add-On Releases - Display all images and files in Print Thread
Elite_360_
08-13-2015, 09:00 PM
Mark As Installed = Support
For Version Information: Go to Post #2 (https://vborg.vbsupport.ru/showpost.php?p=2552912&postcount=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:
[iмg]httр://someserver.net/0000000m.jpg[/iмg]
then regexp work not correctly. And as a result, I have in post follow html:
<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 (http://savepic.su/6054179.htm)
I use next code for replace embeded Images:
$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:
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/showthread.php?p=2554078#post2554078
I hope its not bad idea?
Elite_360_
09-02-2015, 07:46 PM
https://vborg.vbsupport.ru/showthread.php?p=2554078#post2554078
I hope its not bad idea?
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.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.