View Full Version : Recent Attachments
MindTrix
02-05-2004, 10:00 PM
Hack Author: MindTrix
Email: slimshadyandd12@hotmail.com
Description:
Simply adds a box to your forumhome page displaying the 5 most recent attachments and linking to them.
Credits:
Thanks go to assassingod for his incredible help and patients with me. He truely deserves his Mod spot so i would like to say thank you, And sorry for beeing such a pain. And thank you to Boofo who moaned at me for beeing a slacker and giving up easily :p Cheers Mate!!
Screenshot and installation text file attached. (Sorry for the poor HTML i am useless with the stuff)
(15/2/04 Update -- If you have Kentaurus brilliant Attachments In Private Messages hack installed you need to do this fix he posted here
https://vborg.vbsupport.ru/showpost.php?p=476245&postcount=113
To stop PM attachments showing on forumhome.
colicab-d
02-06-2004, 06:33 PM
be amazing if this showed thumbs of the pics :p with an icon for other files :D
MindTrix
02-06-2004, 06:35 PM
Yeah i thought the same to be honest. Guess thats something to aim too get done :)
Princeton
02-06-2004, 07:19 PM
You can use the attachment id to fetch a thumbnail of file (for images) ... use and if statement to display thumbs (look into functions_showthread to add more functionality to your hack)
however, you will also have to think about permissions...
MindTrix
02-06-2004, 07:24 PM
Thanks for the advice ill get right on it
MindTrix
02-06-2004, 09:46 PM
First post updated. Attachments now show up as thumbnails. Hope that is better :p
NuclioN
02-06-2004, 10:03 PM
Great addon. :) Is it possible to stretch the thumbnails in a horizontal block so you can put it under or above the navbar as in the photoposthack where the latest images are displayed in a similar way?
*arie
02-06-2004, 10:06 PM
wow thanks.
LOL @ the latest pics in the attachment. :rolleyes:
NuclioN
02-07-2004, 12:18 AM
Horizontal display:
recent_attachments:
<a href="attachment.php?attachmentid=$recentattachment[attachmentid]" target="_blank">
<img src="attachment.php?attachmentid=$recentattachment[attachmentid]" alt="$recentattachment[filename]" width="62" height="62" border="0"></a> <img src="./spacer.gif" height="0" width="90" border="0">
Under $navbar:
<table class="tcat" cellpadding="0" cellspacing="0" border="0" width="100%" align="center" valign="top">
<tr><td>
$latestattachments
</td></tr></table>
well..this is not 100% proper code but it looks ok on our forum. Untill it is better coded this is an option. :) You can upload a transparant spacer gif to the right dir. and force the space between the thumbnails in the desired width. Keep also in mind that altough it is a thumb the images have the full kb load on the forumhome.
colicab-d
02-07-2004, 09:05 AM
hey thnx dark blue thats handy ;) cause we run a small arts community so this hack is a god send :D
*wonders if an external version showing the last attachment on vbindex etc would be poss :D
MindTrix
02-07-2004, 10:29 AM
Thanks for that Nuclion!!
Colicab-d, what version of vbindex?
gmarik
02-07-2004, 11:02 AM
Please, make a 2 and 3 and 4 row mode, so it would be more comact - will you?
Thanks, man - you're only 18, but what you code is really fine.
colicab-d
02-07-2004, 11:05 AM
latest version mindtrix mate :D
also i know this a bi to ask but.... would it be also possible to show say the latest x attachments, but with only from x forum id :p (if u can accomplish it by mysql ur a god)
memobug
02-08-2004, 06:29 AM
Is it possible to illustrate what this hack does using photographs of people with their clothes on not having sex?
assassingod
02-08-2004, 09:06 AM
MindTrix, could you please upload a non-pornographic attachment please - thanks.
MindTrix
02-08-2004, 10:04 AM
My bad :p Didnt realise to be honest, New screenshot uploaded (and they was not pornographic pictures if you saw them in full size)
Oblivion Knight
02-08-2004, 12:19 PM
Just noticed by visiting your forum that the attachment thumbnails are broken. Is this because I'm a guest? If so, is this default behaviour of the mod?
If it is, instead of displaying the latest attachments box, you may well just want to hide them from guests all together.. Lots of red x's don't exactly attract guests to registering. Just a suggestion.!
MindTrix
02-08-2004, 07:01 PM
Sorry i didnt think of that, or try it, Try this
replace the code in the php file with
if ($bbuserinfo['usergroupid']!= 0) {
//Start recent attachments by Trix
$trix = $DB_site->query("SELECT attachmentid, dateline, filename FROM attachment WHERE dateline < " . TIME() ." ORDER BY dateline DESC LIMIT 5");
while ($recentattachment = $DB_site->fetch_array($trix))
{
eval('$latestattachments .= "' . fetch_template('recent_attachments') . '";');
}
//End recent attachments by Trix
}
Its just a rough guess but i assume it will work
Boofo
02-08-2004, 07:40 PM
Or you could use:
if ($bbuserinfo['userid'])
MindTrix
02-08-2004, 07:41 PM
In the php file?
Boofo
02-08-2004, 07:42 PM
In place of this in your code above. ;)
if ($bbuserinfo['usergroupid']!= 0)
MindTrix
02-08-2004, 07:44 PM
I thought you would need to check it against 0
assassingod
02-08-2004, 07:46 PM
If you use
if ($bbuserinfo['userid'])
It still checks for 0 which is unregistered users. (I think anyway)
So that won't work.
MindTrix
02-08-2004, 07:51 PM
Ahh right, thanks for that
Boofo
02-08-2004, 07:57 PM
Steve, you're wrong. What that basically does is ask whether the user has a userid number. Unregsitered users don't. So, yes, it will work. ;)
assassingod
02-08-2004, 08:02 PM
I'll admit when i'm wrong (And I was):p
I'll know next time hehe
Boofo
02-08-2004, 08:06 PM
That's ok, buddy. You're not alone. ;)
MindTrix
02-08-2004, 08:25 PM
Heck i dont even know what php is
Erwin
02-26-2004, 09:29 AM
What would make this hack very useful is if you could make it so that it shows the latest attachments WITHIN a specific forum or subforums. :)
MindTrix
02-27-2004, 09:32 AM
Guess thats what i need to aim for now then huh :) Thanks for the advice Erwin ill try
Allan
02-27-2004, 09:36 PM
Very Nice , thank MindTrix :)
but, would this be possible to add has this hack the option " contract" (collapse) like origin in Vbulletin ?
Geographic2
03-18-2004, 01:33 PM
Your making us download fullsize pictures for 62x62 or 50x50 display... so in other words on my forum it's sending 1mb photos for display in a format that could do it in 8000 bytes...
Here's the easy easy easy fix:
In recent_attachments template:
Change this:
<img src='attachment.php?attachmentid=$recentattachment[attachmentid]' alt='$recentattachment[filename]' width="50" height="50">
to:
<img src='attachment.php?attachmentid=$recentattachment[attachmentid]&thumb=1' alt='$recentattachment[filename]' width="50" height="50">
Much more efficient. Now you download the thumbnail size photo rather than the fullsize version to be resized in the users browser.
Also consider using only 1 width or height value rather than both
this will allow the ratio between height and width to be maintained
since not all images are perfectly square.
Nice hack.
Clickin install. ;)
MindTrix
03-18-2004, 04:06 PM
Thanks mate :) HTML is not my strong point, i hate it. Thank you for the fix and install click :)
Geographic2
03-19-2004, 02:17 AM
I agree HTML is stupid. :)
mhobelsb
10-30-2004, 08:44 AM
Hello,
great Idea with the attachments...
Would it be possible to show tumbs of attachments in the Forumdisplay? I mean instead of a thread icon show a thumbnail of the attachment inside. So the user can see what is waiting for him inside the post. *G*
would really love that.
thanks
Martin
NuclioN
01-02-2005, 01:44 PM
What would make this hack very useful is if you could make it so that it shows the latest attachments WITHIN a specific forum or subforums. :)
Or the latest attachments on forumhome OUT of a specific subforum
NuclioN
01-06-2005, 06:23 AM
Is it possible to show a 'no thumbnail' image or a default image when someone post a zip, exe etc. file? I've seen it in the forumdisplay attachment addon so maybe it is possible with this to.
VanAusdal
05-09-2005, 03:23 PM
Is there any way to get the href to point to the originating thread rather than the image. I would like my users to be able to go to the thread by clicking the image.
Thanks! Great hack by the way!
VanAusdal
05-12-2005, 02:37 PM
anybody know a way that this could be done? I have tried everything that I can think of. I have tried a number of things but it seems to pull the most recent thread and the the thread that is associated with the image. I can't seem to wrap my head around this.
NuclioN
05-12-2005, 03:26 PM
Yep, i'm also looking for a solution to link the image to the thread it whas placed in. :)
Marco van Herwaarden
05-12-2005, 03:36 PM
showthread.php?t=$recentattachment[threadid]'or something like that probably.
NuclioN
05-12-2005, 05:39 PM
No that's not it. :) Attachments are showing up but links to nowhere
darkon
06-07-2005, 11:30 PM
I worked on the problem to build a link to the posting/thread including the attachment.
I still have to figure out where in the database the "Postcount"-number is stored.. until then i have built a workaround.
In index.php you have to replace the code from the original-hack with this:
//Start recent attachments by Trix
$trix = $DB_site->query("SELECT attachmentid, a.dateline, filename, a.postid, threadid FROM " . TABLE_PREFIX . "attachment a JOIN ".TABLE_PREFIX."post b ON a.postid=b.postid WHERE a.dateline < " . TIME() ." ORDER BY a.dateline DESC LIMIT 3");
And in the recent_attachments template:
<tr>
<td class="alt2">
<div align="center"><a href="attachment.php?attachmentid=$recentattachment[attachmentid]">
<img src='attachment.php?attachmentid=$recentattachment[attachmentid]&thumb=1' alt='$recentattachment[filename]' width="70">
</a></div>
<br> Attachment number $recentattachment[attachmentid]<br/>
<a href="showthread.php?t=$recentattachment[threadid]">In this thread</a><br/>
<a href="showpost.php?p=$recentattachment[postid]">In this posting</a><br/>
</td>
</tr>
(i have included the block into a sidebar on the forumhome)
Take a look at http://www.infam.net/forum/index.php
Hopefully someone could help me to figure out how to get the postcount...
VanAusdal
06-20-2005, 03:07 PM
Great!! Thank you for taking the time to work this out!!!!!
Borimikan
07-09-2005, 03:04 PM
is there possibility to change the background color of the recent atachment box?
and there is a fix to be able to use this hack in Firefox and IE with no displaying errors?
Thanks advanced!
Borimikan
07-12-2005, 03:48 AM
there is some posibility to change the background color of the recents attachments box? or maybe the letters colors!!
Gutspiller
08-02-2005, 02:55 PM
How would I get the latest attachments to appear on a non-vb page though?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.