View Full Version : Thumbnails of Attachments on Forum-Display
Harald_T
07-19-2005, 10:00 PM
Foreword:
This is the old hack of Dechevious, i only changed it to work under 3.5.0 Beta 3.
I've used this hack, to build a gallery for my forum.
You'll need the icon for no Thumbs from Dechevious hack, so be sure
to check his hack out, too.
tamarian
07-20-2005, 07:25 PM
I never saw the original hack, but this is amazing:
http://www.scifi-fan.de/forumdisplay.php?f=60
Well integrated to look like the other galleries, but it is a real vB forum URL :up:
I don't think you need to edit global.php though, that portion can be written in forumdisplay.php, or made as a plugin to the forumdisplay_start hook.
Harald_T
07-20-2005, 07:30 PM
I've just made it, because i want to administrate the gallery through the AdminCP (as soon, as i found out, how...)
Oh, and don't mind, that in my gallery some pictures are missing. I had a little forum crash these days and i'm busy on building it up again.
Harald_T
07-20-2005, 07:38 PM
I'll release the gallery-hack soon, btw.
ohgenki
07-21-2005, 04:36 PM
excellent ! i will wait for this hack !
alkatraz
07-22-2005, 03:30 AM
works great for classifieds
thanks!
Harald_T
07-25-2005, 04:15 PM
I've tested my gallery so far. Works good. You can now define by setting an option, which forum is used as a gallery. So no need for the forumid's any longer.
I will write the install-text now and release it later on this evening, i hope.
tamarian
07-25-2005, 04:24 PM
Harald, you're getting closer to what might be one of the most important hacks :) Looking forward to the gallery hack.
Harald_T
07-25-2005, 04:32 PM
Oh, don't excpect too much for the beginning. Of course there are some things, which still have to be done, but if your looking at my website, you can see, how far i have come. It works fine so far, but as i said, there are still a lot of things to do. But it's a start.
Harald_T
could you add ( display the last 5 Thumbnails from X forum ) on the forum home .
moreover,
we can use a specific variable to display the last x Thumbnails from xx,xx forums on (forum index ) ??
it would be very effective gallery mod with 100% vb integration :)
--------------------------
take an example (IPB):
http://www.lifejourney.com.sa/community/
its desplaying the last 4 Thumbnails from ( forum # 143 ) which is for ( digital arts )
(AND )
desplaying the last 4 Thumbnails from ( forum # 144 ) which is for ( Photography images )
--------------------------
I PM'ed him and he said that the mod is quite simple .. 2 Queries to get the thumbnails and some changes in (forumhome_forumbit_level2_post) :rolleyes:
can you add this feature to the mod .. ??
:)
Harald_T
07-31-2005, 02:11 PM
I'm already working on something like this for my gallery-hack.
Good work Harald_T ..
and im glad to see your gallery .. :)
keep on going .. ;)
Andreas
08-01-2005, 12:03 PM
Nice Hack. But you might want to consinder releasing it as a Plugin to avoid File Edits:
Hook: forumdisplay_query
if (in_array($forumid, array(XX, YY))
{
$hook_query_fields .= ", attachment.attachmendid AS attachmentid";
$hook_query_joins .= " LEFT JOIN " . TABLE_PREFIX . "attachment as attachment ON (attachment.postid = thread.firstpostid)";
}
To make it even more Userfriendly, you could add a setting Show Attachment Thumbnails to Forum Manager, so Users could easily turn this On/Off for individual Forums.
Harald_T
08-01-2005, 04:08 PM
This is a great idea.
If you allow, i will try to add the query to my gallery-hack.
Andreas
08-01-2005, 04:44 PM
Feel free to use it :)
Harald_T
08-01-2005, 04:58 PM
Besides a little typpo it works fine
attachment.attachmendid must be attachment.attachmentid
Andreas
08-01-2005, 06:52 PM
Wonder how this happened ^.^
???`S?LV?R???`
09-16-2005, 10:40 AM
Nice Hack. But you might want to consinder releasing it as a Plugin to avoid File Edits:
Hook: forumdisplay_query
if (in_array($forumid, array(XX, YY))
{
$hook_query_fields .= ", attachment.attachmendid AS attachmentid";
$hook_query_joins .= " LEFT JOIN " . TABLE_PREFIX . "attachment as attachment ON (attachment.postid = thread.firstpostid)";
}
To make it even more Userfriendly, you could add a setting Show Attachment Thumbnails to Forum Manager, so Users could easily turn this On/Off for individual Forums.
I could not get this to work
I got this error on top of the page:
Parse error: parse error, unexpected '{' in /var/www/html/message_board/forumdisplay.php(799) : eval()'d code on line 2
and this one as the vbulletin message:
Unable to add cookies, header already sent.
File: /var/www/html/message_board/forumdisplay.php(799) : eval()'d code
Line: 2
Harald_T
09-18-2005, 09:20 AM
attachment.attachmendid AS attachmentid
Did you see the little typpo? It has to bee attachment.attachmentid, not attachment.attachmendid
mhobelsb
09-19-2005, 08:42 AM
hi Harald_T,
really nice addon. i already use it in my forum and for sure want to use it as soon as the gold is released. any chance that you change it to work as plugin? would really love that. not that the file changes are big, but it would make updateing much easier. :)
thanks again for the good work
martin
ps.: don?t really get there to use the Query of KirbyDE. maybe i am just not really awake. :)
???`S?LV?R???`
09-25-2005, 09:36 PM
hi Harald_T,
really nice addon. i already use it in my forum and for sure want to use it as soon as the gold is released. any chance that you change it to work as plugin? would really love that. not that the file changes are big, but it would make updateing much easier. :)
thanks again for the good work
martin
ps.: don?t really get there to use the Query of KirbyDE. maybe i am just not really awake. :)
having it as a plugin would definitly make it easier
Andreas
09-27-2005, 05:55 PM
Here is the Plugin (which is just a Copy&Paste of the Code I posted earlier ...)
Note: It must be edited: 1, 2 ,3 has to be replaced with the Forumids where you want to activate this.
But as said above, I still think the best thing would be if the was a setting in Forum Manager to easily turn this on/off without having to edit the code.
Harald_T
09-27-2005, 08:32 PM
Sorry, hadn't much time the last days. I think, i've also already made an plugin.
@Kirby: Nice Idea. I'll look after it.
MrNase
10-01-2005, 08:43 AM
Here is the Plugin (which is just a Copy&Paste of the Code I posted earlier ...)
Note: It must be edited: 1, 2 ,3 has to be replaced with the Forumids where you want to activate this.
But as said above, I still think the best thing would be if the was a setting in Forum Manager to easily turn this on/off without having to edit the code.
Doesn't seem to be working with vB3.5 :(
Some threads appear twice, some are even listed three or four times..
GrendelKhan{TSU
10-01-2005, 10:21 AM
anyone else try this for 3.5?
I want to install it but wanna see if its ok. :)
Yes. It has small bug. Thumbnails are from first post in thread and if first post has more than one attachment, there are more than one thread.
mhobelsb
10-02-2005, 05:01 PM
yes, same here. anyone a idea to fix that?
eXtremeTim
10-02-2005, 05:15 PM
Then we just need a group by if their isnt one but it sounds like he needs to add a group by into the query. :)
Yes, that's right. We need to add "GROUP BY" and one "iff" to the SQL query.
my code (in forumdisplay.php)
// gallery hack
if (in_array($forumid, $forumids)) {
$displaythumbs = true;
}
$sql_threads = "
SELECT $votequery $previewfield
thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, replycount, postusername, postuserid, thread.iconid AS threadiconid,
$lastpost_info, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, notes, thread.visible, sticky, votetotal, thread.attach "
. iif($displaythumbs == true, ", attachment.attachmentid AS attachmentid ")
. iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed")
. iif($deljoin, ", deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason")
. iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], ', threadread.readtime AS threadread') . "
FROM " . TABLE_PREFIX . "thread AS thread
$deljoin
" . iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
" . iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
$previewjoin
" . iif($displaythumbs == true, "LEFT JOIN ".TABLE_PREFIX."attachment as attachment ON(attachment.postid = thread.firstpostid) "). "
$tachyjoin
WHERE thread.threadid IN (0$ids)"
. iif($displaythumbs == true, "GROUP BY attachment.postid ") ."
ORDER BY sticky DESC, $sqlsortfield $sqlsortorder
";
$threads=$db->query_read($sql_threads);
//end of gallery hack
Check it :)
sorry, there are still bugs in my code.
rharbison
11-06-2005, 07:46 PM
Any progress on fixing the bugs? Looks like a really good plugin
Yes. Here you have correct code:
// gallery hack (fixed by adek)
if (in_array($forumid, $forumids)) {
$displaythumbs = true;
}
$sql_threads = "
SELECT $votequery $previewfield
thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, replycount, postusername, postuserid, thread.iconid AS threadiconid,
$lastpost_info, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, notes, thread.visible, sticky, votetotal, thread.attach "
. iif($displaythumbs == true, ", attachment.attachmentid AS attachmentid ")
. iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed")
. iif($deljoin, ", deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason")
. iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], ', threadread.readtime AS threadread') . "
FROM " . TABLE_PREFIX . "thread AS thread
$deljoin
" . iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
" . iif($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")") . "
$previewjoin
" . iif($displaythumbs == true, "LEFT JOIN ".TABLE_PREFIX."attachment as attachment ON(attachment.postid = thread.firstpostid) "). "
$tachyjoin
WHERE thread.threadid IN (0$ids) GROUP BY thread.firstpostid
ORDER BY sticky DESC, $sqlsortfield $sqlsortorder
";
$threads=$db->query_read($sql_threads);
//end of gallery hack
Now. Even after update to 3.5.1 everything looks great :)
rharbison
11-06-2005, 08:48 PM
Works great, and I really like it.
One question / suggestion... How do I make this work in the search results? I see they use the threadbit template, but it doesn't show the icons. I'd like to show the thumbnails, even if they show up for all forums.
Any suggestions on how to do that?
rharbison
11-07-2005, 02:16 AM
My members love this! It's getting great reviews.
One question... How does it decide which image to show? It usually, but not always, shows the first image. Sometimes it's the second or third. Any idea how/why that happens?
Also, <beg>PLEASE</beg> somebody tell me how to do this with the "new post" and "today's post" searches. I think it would be very useful!
fabianv
11-14-2005, 09:44 PM
Harald_T, how would I make this work together with your other Gallery hack release but on seperate areas?
Theyre both so good, wish they worked together.. when Install both and I try use this one it just looks like your other gallery release which I dont want for that specific area.. just want thumbnails :P
reply would be great
Harald_T
11-15-2005, 01:25 AM
I'll look after this tomorrow.
Edit: The problem is based on the way the gallery-hack was build up. Wait for the next version (i hope this night), then the problems should be removed.
fabianv
11-15-2005, 05:22 PM
You are a star!!
I will be waiting in suspense! :D
Thank you Thank you Thank you!!!!!
my forum , http://forum.cgcentral.net
Its launched yesterday so its under beta... what will basically happen is under the gallery section the first 3 forums will just be thumbnail.. and the last one (awards) will be that great gallery with the new works on the main page.
Cant wait for your release.. told my friends and they also cant wait! :D
fabianv
11-16-2005, 08:08 PM
when its done please notify in this thread or email me.. i'll put it to good use..
Harald_T
11-18-2005, 11:18 AM
The new version of my gallery is up now. Try it out.
fabianv
11-18-2005, 11:07 PM
The new version of my gallery is up now. Try it out.
Harald I have 2 questions:
1) I installed the new version but now am wondering why when I view my gallery it shows the blocks and everything but no thumbnail at all.. not even on the front page, nowhere.. I added the image as an attachment; why isnt this working?
2) So now I will be able to install both gallery codes?
Harald_T
11-19-2005, 10:21 AM
@fabian: Does a normal attachment show a thumbnail at all?
And yes, now you should be able to use both. If there is any trouble, let me know.
ohgenki
11-21-2005, 06:43 AM
harald: pardon my impudence, but what's ur other gallery hack? i'm looking for a good gallery to display pictures.
hotwheels
12-28-2005, 07:31 PM
works perfectly.....
hotwheels
12-29-2005, 06:16 PM
well, change the above statement........
I woke up today and hoped online and this is what i am recieving now (see attatched image)
I have no idea where to look......I have even tried andrea's plugin.
It is acting like it's not allowing the page to move to the left........the thumbnails are there, i know this because it was working fine yesterday evening......
hotwheels
12-29-2005, 07:26 PM
nevermind.......if you look at the image, my threadicon's are missing.....
I went into my admincp panel, thread display and my default icon path wasn't there.........all better..
thanks
Space Goat
01-02-2006, 04:43 PM
Does anyone know what happens if the first post has more than one attachment? I'm trying to write a similar query, but I am getting the same thread rows returned multiple times for each of their attachments.
I'm curious if this mod has the same problem.
Space Goat
01-02-2006, 05:32 PM
Ah yes, the GROUP BY clause - answered my own question. I should read threads more closely before asking q's.
ConKien
01-17-2006, 07:06 PM
You are a star!!
I will be waiting in suspense! :D
Thank you Thank you Thank you!!!!!
my forum , http://forum.cgcentral.net
Its launched yesterday so its under beta... what will basically happen is under the gallery section the first 3 forums will just be thumbnail.. and the last one (awards) will be that great gallery with the new works on the main page.
Cant wait for your release.. told my friends and they also cant wait! :D
Hi Fabianv, can you show us how to display the first image as thumbnail on forumdisplay.php instead of loading the thumbnail from the thread attachment?
Thanks,
CK
ThomasR
05-29-2006, 06:22 PM
mmh.. I'm a little bit lost here. I'm currently swapping from 3.0.7 to 3.5.4. I have the previous mod for 3.0.7 and as you can imagine, I want to add it to my new forum.
What do I need to do? add only the plugin, like this, no need to modifiy the code for the futur updates of vB? Do I need to edit the code and add the plugin (then, why using a plugin if I need to "hack"?
Sorry if these questions seems stupid ^^;
And thanks for the update of this hacks, IMO, the best :)
top end ms
06-02-2006, 03:49 AM
Does anyone know what happens if the first post has more than one attachment?
It uses the first attachment I beleive. :bunny:
ThomasR
06-11-2006, 06:44 AM
Forgot my last message, no problem installing it!
Marcus Lau
06-15-2006, 04:46 PM
good for 3.5.4
carpzone
08-23-2006, 10:08 AM
Works great, and I really like it.
One question / suggestion... How do I make this work in the search results? I see they use the threadbit template, but it doesn't show the icons. I'd like to show the thumbnails, even if they show up for all forums.
Any suggestions on how to do that?
Somone have an idea for this ?? I'l also really want to know how to do this
alkatraz
08-27-2006, 10:52 PM
anyone using this on 3.6.0? thx!
hotwheels
08-28-2006, 02:36 AM
won't work on 3.6.......there aren't any "iif" statements in 3.6........i made a post in the lounge that will take you to a mod that will do this as a plugin for 3.6 (3.6)
ArchangelX
04-25-2007, 08:00 AM
Big problem...everything was going well until I moved a thread...then this happened! What do I do to fix it? Thanks!
ArchangelX
04-25-2007, 08:18 AM
Found it...it was in the original thread...if you don't have a default icon already set under Admin CP, post this instead of the stock template change:
<!-- Start: idolpx and dechevious Thumbnail in Forum Display Hack - 20041220 -->
<if condition="$show['threadicons']">
<td class="alt2" align="center" valign="middle">
<if condition="$displaythumbs">
<if condition="$thread['attachmentid']">
<a HREF="attachment.php?attachmentid=$thread[attachmentid]">
<img src="attachment.php?attachmentid=$thread[attachmentid]&stc=1&thumb=1" border=0>
</a>
<else />
<img src="images/clear.gif" width=75 height=56 border="0"></if>
<else /><if condition="$show['threadicon']">
<img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /></if></td>
</if>
</if>
<!-- End: Start: idolpx and dechevious Thumbnail in Forum Display Hack - 20041220 -->
ThomasR
07-10-2007, 07:13 PM
I bump this thread, because I have a little problem with the attachments orders. I installed the Andreas plugin with no problems... except that it takes the first attachement of a thread... but if a user attach a zip and an image in this first post, it will consider that it doesn't have a thumbnail, because it takes the zip as the first attachement.
An idea about how to change that?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.