View Full Version : Attachment Browser
El_Muerte
12-21-2005, 10:00 PM
This plugin adds an attachment browser to selected forums. The attachment browsers shows all the thumbnails of attached images in all posts in the current from.
Installation
Install the product xml and edit the FORUMDISPLAY template. Add the following code whereever you like:
<if condition="$show['attachments']">
$attachmentbrowser
</if>
I put it above the thread list.
In order to enable the thumbnail browser for a forum you will have to set "Show attachment browser" to yes in the forum manager (AdminCP).
System changes
This plugin adds two templates:
attbrs_attachment : the main block of the attachment browser
attbrs_attachment_bit : the thumbnail part for each attachment
and two phrases:
ab_image_larger_version_x_y_z : a copy of 'image_larger_version_x_y_z', the original was not available in the scope it was needed
ab_title : the title used in the browser
It also modifies the forum table, it will add a new field called 'gallery'. The field is created during installation and removed on uninstall.
This plugin has one setting in it's own category which controls the maximum number of thumbnails to show per page.
Live demo
http://el-muerte.student.utwente.nl/lba/forum/forumdisplay.php?f=23
Change log
Changes since v1.0.1:
Fixed table prefix
Added new option 'enable pager'. Width this you can disable the pager which can be a performance hit on large forums.
Added new option 'Browser width'. Which will set the fallback browser width to use for MSIE. MSIE doesn't properly size the scrollable area in the default template, this is a dirty workaround.
Changes since v1.1.0:
Templates are now grouped
Installer is a bit more safe (e.g. no serious error when the table already has a `gallery` field)
Attachment browser is now collapsable
Thread title can be trimmed to a certain length
Changes since v1.2.0:
Browser is not shown when the user has to permissions to view attachments
El_Muerte
12-22-2005, 12:55 PM
Doh, forgot to properly link the username, it's fixed now in 1.0.1
The Chief
12-22-2005, 02:03 PM
lookin good, though I don't need ;)
El_Muerte
12-22-2005, 02:48 PM
Ok, there's a little issue with MSIE, as usual it doesn't handle dimensions correctly. So there's no scrollbar, instead it's displayed in full, streching the page a lot.
A quick fix is to edit the 'attbrs_attachment' template and change the div in the 2nd row to:
<div style="overflow: auto; width: auto !important; width: 800px; margin: auto;">
This will give the browser a fixed width of 800px in MSIE only.
Wachtmeister
12-22-2005, 04:53 PM
Really very interesting. I'll wait until the MSIE thing is "fixed" ;) Really a very good idea!
klaush
12-22-2005, 05:18 PM
Thanks, but:
Table 'xxxx.attachment' doesn't exist
Looking for the correct Prefix? Where to change it?
El_Muerte
12-22-2005, 07:09 PM
Thanks, but:
Table 'xxxx.attachment' doesn't exist
Looking for the correct Prefix? Where to change it?
oh crap, completely forgot about table prefixes
Chris M
12-22-2005, 07:35 PM
Looks rather interesting :)
Chris
silurius
12-22-2005, 09:47 PM
Nice one, El_Muerte! Can't wait to install.
*Clicks install and awaits final version*
cbr929rrerion
12-23-2005, 12:50 AM
OK.. I have to admit but can you or someone make it do thumbnails that are like 150 X 150 or so.. I have my thumbs set large so it dont work too well, is there a way to add a way to set thumb size ?
If we can get the images smaller I will enable it in a heartbeat...
El_Muerte
12-23-2005, 05:35 AM
OK.. I have to admit but can you or someone make it do thumbnails that are like 150 X 150 or so.. I have my thumbs set large so it dont work too well, is there a way to add a way to set thumb size ?
If we can get the images smaller I will enable it in a heartbeat...
afaik there is no nice way to scale thumbnails, or at least not widthout a lot of extra processing. But you could force dimensions by editing the 'attbrs_attachment_bit' template and add `height="100"` to the img tag, or something like that.
Wachtmeister
12-23-2005, 10:54 AM
Can this add on also be shown only in seperate threads or categories?
I have a huge Avatar and Smiley compilation and would love to have this one only on those threads or forums.
Before i import the product, i ask ;)
Thanks, Wachtmeister
silurius
12-23-2005, 06:20 PM
How should I edit the product to address the dupe column name?
Database error in vBulletin 3.5.2:
Invalid SQL:
ALTER TABLE forum ADD gallery SMALLINT(6) DEFAULT '0' NOT NULL;
MySQL Error : Duplicate column name 'gallery'
Error Number : 1060
Date : Friday, December 23rd 2005 @ 12:16:57 PM
Script : http://www.examplesite.com/forum/admincp/plugin.php
Referrer : http://www.examplesite.com/forum/admincp/plugin.php?do=productadd
IP Address : 71.131.12.1
Username :
Classname : vb_database
Never mind I got it. Changed "gallery" to "atb_gallery" in plugin.
cbr929rrerion
12-24-2005, 02:57 AM
afaik there is no nice way to scale thumbnails, or at least not widthout a lot of extra processing. But you could force dimensions by editing the 'attbrs_attachment_bit' template and add `height="100"` to the img tag, or something like that.
I did that and added my theme to it and a scroll style.. looks sweet.. My members love it..
tamborinegal
12-24-2005, 05:25 AM
Wow El_Muerte, this looks really neat. I'm too busy with Christmas stuff to install it now but I'll be coming back to look at this again for sure.
Thanks
Clancy
cbr929rrerion
12-26-2005, 12:46 PM
on all the attachements on my board there is the thumb and the attachment.. could you not have it putt the thumb for the image?if so where would you change that one part?
El_Muerte
12-27-2005, 11:39 AM
It does use the thumb, and the thumb only. Attachments without a thumbnail are not displayed.
cbr929rrerion
12-30-2005, 03:18 PM
oh.. ok.. question... can we set the the default to be yes in show attachement browser? I have lots of forums and its a job going in and setting them all to yes..
Any way to make the xml default to yes not no?
I installed as per instructions but nothing shows on my forumdisplay page. I aslo cannot find the two templates that were supposed to be added. I am fairly new to all of this so any help is very greatly appreciated.
Edited to add: I took a peek at the manage products in admincp for this modificiation and this is what the install code says:
$res = $db->query("DESCRIBE " . TABLE_PREFIX . "forum gallery");
if ($colinfo = $db->fetch_array($res))
{
if (!preg_match("#int\(#", $colinfo["Type"]))
{
print_dots_stop();
print_cp_message('Unable to install this plugin because the forum table is not compatible. (column gallery has an invalid type.)');
}
}
else {
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD gallery SMALLINT(6) DEFAULT '0' NOT NULL");
}
Is this why the templates were not added and how do I fix this?
Thanks in advance, again.
El_Muerte
12-30-2005, 07:00 PM
oh.. ok.. question... can we set the the default to be yes in show attachement browser? I have lots of forums and its a job going in and setting them all to yes..
Any way to make the xml default to yes not no?
Yes, in the ALTER TABLE db query just change the "DEFAULT '0'" to "DEFAULT '1'"
I installed as per instructions but nothing shows on my forumdisplay page. I aslo cannot find the two templates that were supposed to be added. I am fairly new to all of this so any help is very greatly appreciated.
The templates are grouped in the group "Attachment Browser".
cbr929rrerion
12-30-2005, 09:25 PM
ok.. I changed this
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "forum ADD gallery SMALLINT(6) DEFAULT '1' NOT NULL");
and reinstalled the xml, still says no..
Did I change the wrong thing or what do I need to do?
El_Muerte
12-31-2005, 08:36 AM
you need to uninstall and then reinstall, during upgrading the uninstall code isn't executed.
or you could simple execute a db query setting all values of gallery to 1, e.g.
update forum set gallery = 1;
cbr929rrerion
12-31-2005, 04:25 PM
you need to uninstall and then reinstall, during upgrading the uninstall code isn't executed.
or you could simple execute a db query setting all values of gallery to 1, e.g.
update forum set gallery = 1;
Thank you, I did the db query and it took less than the blink of an eye to do all 178 ..
That was so helpful.. BTW.. my members love your work, I appreciate it.
Mastar
12-31-2005, 08:20 PM
I can't get it to show on my forum. I had Gallery installed but I saw the conflick, now I deleted Gallery and still doesn't show. Help!!
cbr929rrerion
01-10-2006, 04:21 PM
I have a question, it works perfectly except 1 thing..
If your not a registered user, it shows everything except where the pics are its just the blank image place holder. Any way to make a default gif to put there or just not show it at all if not registered?
It looks terriable to non-members..
El_Muerte
01-10-2006, 06:05 PM
uhm.. do you have a restriction on viewing images on your forum?
Club3G
01-10-2006, 06:16 PM
* Club3G clicks install
Couple of quick questions:
Is there a way to get it to span the same width as the forum tables? The fixed width looks a little off at higher resolutions.
Also, a non-fixed height would be awesome. The horizontal scrollbar is great, but the vertical just looks ugly.
Screenshot:
http://www.club3g.com/members/chris/attachplugin.jpg
Great mod otherwise, thank you! :D
cbr929rrerion
01-10-2006, 07:14 PM
of course I do, only members can see images...
I dont want non-members to be able to view images.
So is there a way to make it load a non-member gif that I can make or just not show up at all to non members? I would prefer the image of my choice in its place, maybe an if statement or something?
cbr929rrerion
01-11-2006, 02:26 AM
anyone know how to add an if statement to have it show a predetermind image to non-members?
El_Muerte
01-11-2006, 05:08 PM
* Club3G clicks install
Couple of quick questions:
Is there a way to get it to span the same width as the forum tables? The fixed width looks a little off at higher resolutions.
Also, a non-fixed height would be awesome. The horizontal scrollbar is great, but the vertical just looks ugly.
Screenshot:
http://www.club3g.com/members/chris/attachplugin.jpg
Great mod otherwise, thank you! :D
Only MSIE has a fixed width, the reason for this is because MSIE is broken and doesn't properly size the table cell. So unless you can find a way to make MSIE behave properly it can't be fixed.
anyone know how to add an if statement to have it show a predetermind image to non-members?
<if condition="$bbuserinfo['userid'] == 0">
// ...
</if>
(not tested)
cbr929rrerion
01-13-2006, 07:19 PM
Only MSIE has a fixed width, the reason for this is because MSIE is broken and doesn't properly size the table cell. So unless you can find a way to make MSIE behave properly it can't be fixed.
<if condition="$bbuserinfo['userid'] == 0">
// ...
</if>
(not tested)
Nope.. Dont work...
Club3G
01-14-2006, 04:46 PM
Working fine in IE for me (aside from the spanning issue), however the thumbs aren't showing up in Mozilla.
Edit: 'Doh, wasn't logged in. :D
cbr929rrerion
01-14-2006, 09:22 PM
Yeah.. looks like crap with missing images if your a non-member..
Is there any way to limit it to the last 5 attachements..
I am going to disable this until someone can find a way to either 1) apply a default image for non-members to see or 2) hide it completely to non-members. Sorry but it just looks like crap to non-members and looks like its broke..
Club3G
01-14-2006, 11:08 PM
Unstalling as well unfortunately. The MSIE bug, plus the fact that the vertical scrollbar looks rediculous, along with what cbr929 mentioned about the non-members getting an ugly blurb of text outweigh the cool factor of it.
cbr929rrerion
01-15-2006, 03:16 PM
I really like this and I really want to use it, I found out how to limit it to show just 5 latest attachements and all that but the non-member still can only see an ungly missing image and it looks broken.
Can some one please write something that if they are not a registerd member or if the user group is not, #,#,#, then it will display an image such as nonmember.gif
El_Muerte
01-16-2006, 06:35 PM
Version 1.2.1 should hide the attachment browser when the user has no permission to view attachments in the selected forum. E.g. the same check as the attachment code uses.
El_Muerte
01-16-2006, 06:37 PM
Unstalling as well unfortunately. The MSIE bug, plus the fact that the vertical scrollbar looks rediculous
You can always change the template so it looks different.
cbr929rrerion
01-16-2006, 08:11 PM
Did the update.. works flawless..
Thank you.. The only thing I would change for a future upgrade is have it show a default gif, that way they know they are missing out on images unless they join.. help to entice membership...
Thanks for this much tho..
LBmtb
01-24-2006, 04:45 AM
Any way to make it display attachments from sub-forums?
bashy
02-05-2006, 03:07 PM
This i would like to see in the next update
Any way to make it display attachments from sub-forums?
Also when i selct a page no. manualy i get nothing, as good as a blank page.
If i click my nice prev or next buttons then all is well!!
Any thoughts?
dethfire
03-03-2006, 07:45 PM
what about other attachment files, not just graphics?
tamborinegal
04-11-2006, 05:39 AM
Michiel, finally got this installed and it works very well... thanks! :)
I don't suppose this could be altered to show other attachments as well... for example .mp3 files.
Thanks again.
Clancy
mahakala
08-08-2006, 08:51 PM
to be continued?
TechGuy
08-26-2006, 02:12 PM
Any chance this will work in 3.6?
El_Muerte
08-27-2006, 06:42 PM
Michiel, finally got this installed and it works very well... thanks! :)
I don't suppose this could be altered to show other attachments as well... for example .mp3 files.
Thanks again.
Clancy
no plans for that.
Any chance this will work in 3.6?
it works on my site.
JohnBee
10-19-2006, 07:29 PM
Nice hack!
The page jump option doesn't work 'invalid thread error'
JohnBee
10-19-2006, 07:33 PM
I'd love to see this on its own page :)
Sort of like an attachment gallery thingy.
JohnBee
11-03-2006, 06:22 AM
I would like to dedicate an entire page to this great mod.
is there a way to make the viewer taller and allow rows of images as well?
I tried to edit the templates but the thumbnails would not wrap no matter what I tried.
thanks in advance for this great hack
jyajay
12-08-2006, 12:43 PM
Is it possible to have the browser also at the forumhome?
maxicep
05-04-2007, 09:39 AM
not worked on my 3.62 :(
voter
08-08-2007, 01:17 PM
Where is in forum manager (AdminCP) for vb 3.6 especially "Show attachment browser" that must be puted to yes ??
Jase2
05-18-2008, 09:09 PM
This work with 3.7 ?
TechGuy
05-19-2008, 03:02 AM
Seems to be working fine for us on 3.7. :)
Jase2
05-19-2008, 10:46 PM
Thanks, TechGuy! =)
Jase2
05-24-2008, 03:35 PM
Probably best caching all templates ;)
Alfa1
07-25-2008, 06:03 PM
If you have changed the code to cache all templates, then please post the fix here.
Does anyone know if this one is better than this one: https://vborg.vbsupport.ru/showthread.php?t=66800 ?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.