View Full Version : Attachment Size in Postbit (like vb3)
tpearl5
11-19-2003, 10:00 PM
First off, I take no credit for this hack. It was created by Mist. He does some wonderful work! If you need something custom made, contact him.
I decided to release this as I thought it may be useful to others.
What it does: This hack simply adds the file size (in kb) next to an attachment, kinda like vb3 does. vb3 uses bytes, but I thought it would be cleaner in kb
One edit each to showthread.php and functions.php One modification to postbit_attachments template.
I cannot provide support for this hack.
corsacrazy
11-20-2003, 06:36 PM
nice work matey :)
FleaBag
11-21-2003, 05:59 AM
Nice work, I'll add this to my site as I've been up all night working on it! :)
MindTrix
11-21-2003, 02:21 PM
Nice one mate ;) any chance you could PM me how much it cost to get it done? Im just thinking of getting a custom one made thats all and needed a rough idea. I'ma install this baby now :) Cheers!
Nice one mate ;) any chance you could PM me how much it cost to get it done? Im just thinking of getting a custom one made thats all and needed a rough idea. I'ma install this baby now :) Cheers!
nice job :D
Dean C
11-21-2003, 08:24 PM
Nice one mate ;) any chance you could PM me how much it cost to get it done? Im just thinking of getting a custom one made thats all and needed a rough idea. I'ma install this baby now :) Cheers!
What are you talking about Liam :)?
MindTrix
11-21-2003, 08:46 PM
I've thought of a couple of hacks i would like made, but money is the issue for me, Basically i cant afford to spend out loads on a hack :p Hence me asking how much this one cost
gmarik
11-22-2003, 07:53 AM
Thanks, it's great!
Could you make another add-on, so I can choose the place where the attachment link shows up - in the left or right corner, or at the top of the post, can you?!
Dean C
11-22-2003, 09:43 AM
Ok then please contact me in private instead of discussing this publically :)
MindTrix
11-22-2003, 09:53 AM
Yeah fair enough but i wasnt really discussing it ;) Just asked him to PM me telling me how much it cost. So you might hear from me soon Mist ;)
CarolinaKid
11-23-2003, 08:50 AM
I am runing vb 2.3 and installed this hack but all attachments says this Files downloaded X amount of times 0 kbs No matter file size it is allways 0kb any ideas
Giveit2u43
11-25-2003, 02:19 AM
haven`t downloaded but I`m guessing that this will only work on new attachments as it writes the filesize into the table along with the rest of the attachment data and then just reads it from there for the postbit..
tpearl5
11-25-2003, 05:46 PM
I am runing vb 2.3 and installed this hack but all attachments says this Files downloaded X amount of times 0 kbs No matter file size it is allways 0kb any ideas
Are you sure you copy/pasted everything correctly?
tpearl5
11-25-2003, 05:47 PM
haven`t downloaded but I`m guessing that this will only work on new attachments as it writes the filesize into the table along with the rest of the attachment data and then just reads it from there for the postbit..
Nope, it works with all existing attachments
CarolinaKid
11-26-2003, 03:40 AM
Here is what i have done.
In functions.php
if ($post[attachmentid]!=0 and $post[attachmentvisible]) {
$post[attachmentextension]=strtolower(getextension($post[filename]));
$post['attachlength'] = round(($post['attachlength'] / 1024), 1);
$post['filename'] = censortext(htmlspecialchars($post['filename']));
In showthread.php
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,".iif($forum[allowicons],'icon.title as icontitle,icon.iconpath,','')."
attachment.attachmentid,attachment.filename,LENGTH (attachment.filedata) AS attachlength,attachment.visible AS attachmentvisible,attachment.counter
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")."
Then in postbit attachment i have this
<p><normalfont><img src="{imagesfolder}/attach/$post[attachmentextension].gif" width="16" height="16" border="0" alt="">Attachment: <a href="attachment.php?s=$session[sessionhash]&postid=$post[postid]" target="_blank">$post[filename]</a></normalfont><br>
<smallfont>This has been downloaded $post[counter] time, $post[attachlength]kb(s).</smallfont></p>
MindTrix
11-26-2003, 10:27 PM
Just a minor note tpearl5, your installation instructions is missing the $ sign off of the 1st piece of code to find.
This bit--
post[attachmentextension]=strtolower(getextension($post[filename]));
As i said minor note :)
David_McPherson
11-29-2003, 06:10 PM
Here is what i have done.
In functions.php
if ($post[attachmentid]!=0 and $post[attachmentvisible]) {
$post[attachmentextension]=strtolower(getextension($post[filename]));
$post['attachlength'] = round(($post['attachlength'] / 1024), 1);
$post['filename'] = censortext(htmlspecialchars($post['filename']));
In showthread.php
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,".iif($forum[allowicons],'icon.title as icontitle,icon.iconpath,','')."
attachment.attachmentid,attachment.filename,LENGTH (attachment.filedata) AS attachlength,attachment.visible AS attachmentvisible,attachment.counter
".iif($avatarenabled,",avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline","")."
Then in postbit attachment i have this
<p><normalfont><img src="{imagesfolder}/attach/$post[attachmentextension].gif" width="16" height="16" border="0" alt="">Attachment: <a href="attachment.php?s=$session[sessionhash]&postid=$post[postid]" target="_blank">$post[filename]</a></normalfont><br>
<smallfont>This has been downloaded $post[counter] time, $post[attachlength]kb(s).</smallfont></p>
I have this same problem.... Ideas?
Allan
11-30-2003, 07:19 AM
I am runing vb 2.3 and installed this hack but all attachments says this Files downloaded X amount of times 0 kbs No matter file size it is allways 0kb any ideas
I same the prob, is there has a solution?
mskgr
11-30-2003, 12:44 PM
I also have the 0kbs problem on vb 2.3.2. I doubled checked everything twice... even removed it and installed it again... but still nothing :(
Recluse
11-30-2003, 05:20 PM
I also have the 0kbs problem on vb 2.3.2. I doubled checked everything twice... even removed it and installed it again... but still nothing :(
in 2.2.9 the showthead.php has
attachment.attachmentid,attachment.filename,attach ment.visible AS attachmentvisible,attachment.counter
twice, the second one is what needs replace.
good hack btw
David_McPherson
11-30-2003, 09:59 PM
That did it... Thanks sir.
mskgr
12-05-2003, 01:51 AM
in 2.2.9 the showthead.php has
attachment.attachmentid,attachment.filename,attach ment.visible AS attachmentvisible,attachment.counter
twice, the second one is what needs replace.
good hack btw
That did it :) Thanks for helping out !
* mskgr clicks install :)
Skyline_GT
12-27-2003, 11:09 PM
nice
TheLab
01-18-2004, 03:30 PM
I must been doing something wrong in here, although i checked it twice,
The files is 20kbs, not 20320kbs..
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.