3 of 3
3
Plugin Request: File Size Tag?
Posted: 08 January 2008 11:56 AM   [ Ignore ]   [ # 37 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  04-17-2006

Is it possible to have a sort of “virtual” folder set in the upload preferences to use in the plugin syntax?

More specifically, I have a set of folders with MP3 files in them. Every year we move to using a new folder with that year label. So we have /2006, /2007 and now /2008. Is it possible to set the upload folder as the base folder that those year folders sit in and then program the back end to look deeper according to the year?

My initial syntax (that did not work) looked like this:

<a href="http://mysite.com/podcast/audio/{entry_date format="%Y/%m.%d.%y.mp3"}">Download Audio</a> &raquo{exp:filesizer filename="{entry_date format="%Y/%m.%d.%y.mp4"}" upload_pref="7" decimals="1" zero_decimals="no"} {fs:file_extension}{fs:file_size}{fs:size_unit} {/exp:filesizer} 

The path in EE to download the file does work. But the Filesizer breaks, even though the error code shows the path perfectly. It just returns the error instead of delivering the file size.

Any ideas on whether this is possible? I am trying to avoid having a whole bunch of folders listed in the file upload preference. And to avoid a lot of conditionals in the back-end switching syntax/folders based on the year of the entry.

 Signature 

http://davidrussell.net | http://twitter.com/davidrussell

Profile
 
 
Posted: 08 January 2008 12:01 PM   [ Ignore ]   [ # 38 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  168
Joined  07-22-2004

Hm.. good question, I’m in the middle of another thing right now, but I’ll have a look asap and see if I can find out what’s breaking it.
In the meanwhile, would you mind posting the error message here?
Dont forget to edit out any sensitive (account) details.

Thanks.

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

Profile
 
 
Posted: 08 January 2008 12:23 PM   [ Ignore ]   [ # 39 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  04-17-2006

Here’s the error code:

Error opening file: “/path-to/htdocs/theaterchurch/subdomains/media/podcast/video/2007/12.09.07.mp4”

The actual file can be seen at http://media.theaterchurch.com/podcast/video/2007/12.09.07.mp4

 Signature 

http://davidrussell.net | http://twitter.com/davidrussell

Profile
 
 
Posted: 08 January 2008 12:26 PM   [ Ignore ]   [ # 40 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  04-17-2006

By the way, I’m not really using EE to upload these files. I am using FTP. I am just trying to get EE to look at a base directory and then have filesizer look deeper within according to the entry_date variable. So it won’t matter that the path in EE’s upload prefs doesn’t go all the way to the directory where the files actually are because I am not using the upload feature to get them there.

 Signature 

http://davidrussell.net | http://twitter.com/davidrussell

Profile
 
 
Posted: 09 January 2008 03:15 AM   [ Ignore ]   [ # 41 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  168
Joined  07-22-2004

Ok, I’ve looked into it, and I think it’s not working because you’re passing it a “folder/filename”.
I want to give you the option to silence the error, but I don’t want to break how the plugin works for everyone else.

I can add a quickfix param called additional_path=”” where you can use {current_time format=”%Y”} or whatever to make the paths a little less static, would that do you any good?

I’ll also add silence=“yes”, to mute the error message.

edit: wrote too fast, forgot to think twice.

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

Profile
 
 
Posted: 09 January 2008 12:05 PM   [ Ignore ]   [ # 42 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  04-17-2006

Correct.

Yes, that would be quite nice to have a little custom version that functions the way I need it to! Is there any risk involved from a security standpoint, or is this merely an unorthodox approach that wouldn’t merit support for others?

Thanks so much!

 Signature 

http://davidrussell.net | http://twitter.com/davidrussell

Profile
 
 
Posted: 16 January 2008 03:29 PM   [ Ignore ]   [ # 43 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  04-17-2006

ExpressionEngineer Thanks for all your help on this. I really need to get something rolling on this fairly quickly. Obviously, I don’t mean to be pushy. After all, your helping me out a ton and I love the elegance of your solution! But I would need that tweak before it will work for me.

If I need to look another direction, let me know so I can try to get a solution in place. If you think it will only be a little more time, I’d love to wait it out. I just need an update. smile

Thanks!

 Signature 

http://davidrussell.net | http://twitter.com/davidrussell

Profile
 
 
Posted: 17 January 2008 02:31 AM   [ Ignore ]   [ # 44 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  168
Joined  07-22-2004

Sorry about the delay.
I’m working around the clock on multiple things right now and have
very limited time to look at this (no time at all really), but I can
give it a proper whirl after the weekend, or if anyone else want
to download the code and mod it for you that’s perfectly fine with me.

Let me know if you need me to look at it after the weekend.

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

Profile
 
 
Posted: 17 January 2008 12:14 PM   [ Ignore ]   [ # 45 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  04-17-2006

I’ll wait it out. Thanks again for helping me out on this. I am under some strain right now with projects as well, so I know the feeling. smile

 Signature 

http://davidrussell.net | http://twitter.com/davidrussell

Profile
 
 
Posted: 17 January 2008 01:55 PM   [ Ignore ]   [ # 46 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  168
Joined  07-22-2004

Thanks, I’ll get back to you on monday.

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

Profile
 
 
Posted: 16 June 2009 01:25 PM   [ Ignore ]   [ # 47 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  269
Joined  03-09-2009

thought I’d revive this thread. I am using this plugin, which I must say is awesome!

I am receiving an error here and there with particular files though which doesn’t make sense.
here is a peak at the code

template code:

<dl><dt>&#187; Software</dt>
     
<dd>{exp:weblog:entries weblog="brochures" search:bbrand="toshiba" search:bcat="ipsoftware" }
<a href="{brolink}">{title}</a>{exp:filesizer filename="{brolink}" upload_pref="3" decimals="1" zero_decimals="no"} {fs:file_size}{fs:size_unit} {/exp:filesizer}  {if no_results} No manuals for this category yet{/if}<br />
     
{/exp:weblog:entries}
     
</dd></dl

rendered page:

NVR Software <—that is a link (works)  Error opening file: “F:/web/silmaritsite/files/manuals/NVR_software.pdf”  <—this is where the filesize normally shows.

It is very strange. it is the exact same code everywhere, but in some small instances it isn’t working. I thought it might be because of the length of the filename, but that is not the case. (have both short and long file names its happening to).

Profile
 
 
Posted: 16 June 2009 02:39 PM   [ Ignore ]   [ # 48 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  269
Joined  03-09-2009

i think i found the problem.

I have files that are in a subdirectory of the specified file upload directory. All of those, the filesize plugin isn’t noticing the subdirectory in the rendered path.

Now, how could we fix that??

Profile
 
 
Posted: 22 June 2009 09:04 PM   [ Ignore ]   [ # 49 ]  
Summer Student
Total Posts:  3
Joined  01-14-2009

Nice work,
however one (tiny little) thing:

-> 1 kilobyte (kB) = 8 kilobits (kb) wink

Profile
 
 
Posted: 09 November 2009 08:45 PM   [ Ignore ]   [ # 50 ]  
Grad Student
Avatar
Rank
Total Posts:  86
Joined  10-28-2008

This very useful, it allowed me to get rid of a few user-input fields. I’m using it for press release attachments (example).

I heard about it on episode one of http://ee-podcast.com/

Thank you!

 Signature 

@mahalie
EE: http://mithun.com
Blog: http://23rdworld.com

Profile
 
 
   
3 of 3
3