vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Attachment Size in Postbit (like vb3) (https://vborg.vbsupport.ru/showthread.php?t=58725)

tpearl5 11-19-2003 10:00 PM

Attachment Size in Postbit (like vb3)
 
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!

Dan 11-21-2003 06:54 PM

Quote:

Originally Posted by MindTrix
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

Quote:

Originally Posted by MindTrix
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

Quote:

Originally Posted by CarolinaKid
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

Quote:

Originally Posted by Giveit2u43
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
Code:

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
Code:

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
Code:

<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--

PHP Code:

post[attachmentextension]=strtolower(getextension($post[filename])); 

As i said minor note :)

David_McPherson 11-29-2003 06:10 PM

Quote:

Originally Posted by CarolinaKid
Here is what i have done.
In functions.php
Code:

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
Code:

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
Code:

<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

Quote:

Originally Posted by CarolinaKid
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

Quote:

Originally Posted by mskgr
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
Code:

attachment.attachmentid,attachment.filename,attachment.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

Quote:

Originally Posted by Recluse
in 2.2.9 the showthead.php has
Code:

attachment.attachmentid,attachment.filename,attachment.visible AS attachmentvisible,attachment.counter
twice, the second one is what needs replace.


good hack btw


That did it :) Thanks for helping out !

[high]* mskgr clicks install :)[/high]

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..


All times are GMT. The time now is 03:52 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01224 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (1)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (24)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete