PDA

View Full Version : Thumbnails of Attachments on Forum-Display


Harald_T
20 Jul 2005, 20:08
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
20 Jul 2005, 21:25
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
20 Jul 2005, 21:30
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
20 Jul 2005, 21:38
I'll release the gallery-hack soon, btw.

ohgenki
21 Jul 2005, 18:36
excellent ! i will wait for this hack !

alkatraz
22 Jul 2005, 05:30
works great for classifieds

thanks!

Harald_T
25 Jul 2005, 18:15
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
25 Jul 2005, 18:24
Harald, you're getting closer to what might be one of the most important hacks :) Looking forward to the gallery hack.

Harald_T
25 Jul 2005, 18:32
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.

mooj
31 Jul 2005, 16:06
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
31 Jul 2005, 16:11
I'm already working on something like this for my gallery-hack.

mooj
31 Jul 2005, 16:43
Good work Harald_T ..
and im glad to see your gallery .. :)

keep on going .. ;)

Andreas
01 Aug 2005, 14:03
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
01 Aug 2005, 18:08
This is a great idea.

If you allow, i will try to add the query to my gallery-hack.

Andreas
01 Aug 2005, 18:44
Feel free to use it :)

Harald_T
01 Aug 2005, 18:58
Besides a little typpo it works fine

attachment.attachmendid must be attachment.attachmentid

Andreas
01 Aug 2005, 20:52
Wonder how this happened ^.^

`SLVR`
16 Sep 2005, 12:40
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
18 Sep 2005, 11:20
attachment.attachmendid AS attachmentid


Did you see the little typpo? It has to bee attachment.attachmentid, not attachment.attachmendid

mhobelsb
19 Sep 2005, 10:42
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.: dont really get there to use the Query of KirbyDE. maybe i am just not really awake. :)

`SLVR`
25 Sep 2005, 23:36
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.: dont 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
27 Sep 2005, 19:55
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
27 Sep 2005, 22:32
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
01 Oct 2005, 10:43
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
01 Oct 2005, 12:21
anyone else try this for 3.5?

I want to install it but wanna see if its ok. :)

Adek
01 Oct 2005, 18:03
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
02 Oct 2005, 19:01
yes, same here. anyone a idea to fix that?

eXtremeTim
02 Oct 2005, 19:15
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. :)

Adek
06 Oct 2005, 23:33
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 :)

Adek
16 Oct 2005, 15:46
sorry, there are still bugs in my code.

rharbison
06 Nov 2005, 21:46
Any progress on fixing the bugs? Looks like a really good plugin

Adek
06 Nov 2005, 21:52
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
06 Nov 2005, 22:48
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
07 Nov 2005, 04:16
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
14 Nov 2005, 23:44
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
15 Nov 2005, 03:25
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
15 Nov 2005, 19:22
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
16 Nov 2005, 22:08
when its done please notify in this thread or email me.. i'll put it to good use..

Harald_T
18 Nov 2005, 13:18
The new version of my gallery is up now. Try it out.

fabianv
19 Nov 2005, 01:07
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
19 Nov 2005, 12:21
@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
21 Nov 2005, 08:43
harald: pardon my impudence, but what's ur other gallery hack? i'm looking for a good gallery to display pictures.

hotwheels
28 Dec 2005, 21:31
works perfectly.....

hotwheels
29 Dec 2005, 20:16
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
29 Dec 2005, 21:26
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
02 Jan 2006, 18:43
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
02 Jan 2006, 19:32
Ah yes, the GROUP BY clause - answered my own question. I should read threads more closely before asking q's.

ConKien
17 Jan 2006, 21:06
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
29 May 2006, 20:22
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
02 Jun 2006, 05:49
Does anyone know what happens if the first post has more than one attachment?

It uses the first attachment I beleive. :bunny:

ThomasR
11 Jun 2006, 08:44
Forgot my last message, no problem installing it!

Marcus Lau
15 Jun 2006, 18:46
good for 3.5.4

carpzone
23 Aug 2006, 12:08
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
28 Aug 2006, 00:52
anyone using this on 3.6.0? thx!

hotwheels
28 Aug 2006, 04:36
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
25 Apr 2007, 10:00
Big problem...everything was going well until I moved a thread...then this happened! What do I do to fix it? Thanks!

ArchangelX
25 Apr 2007, 10:18
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
10 Jul 2007, 21:13
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?