We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Extract URL Plus 2

Development and Programming

@i0n's avatar
@i0n
7 posts
16 years ago
@i0n's avatar @i0n

This plugin is a little gem and no mistake. Thanks for sharing!

       
Andrew Macpherson's avatar
Andrew Macpherson
38 posts
15 years ago
Andrew Macpherson's avatar Andrew Macpherson

Thanks so much for this great extension, but my client has only one request that I can’t quite handle. They really want a space between the numbers and letters in the file size – for example: 917.4 KB, not 917.4KB.

I know this is being a bit picky, but is there any way to achieve this at the moment? Or is it an option that could be quickly added to the plug-in?

       
Daniel Walton's avatar
Daniel Walton
553 posts
15 years ago
Daniel Walton's avatar Daniel Walton
Thanks so much for this great extension, but my client has only one request that I can’t quite handle. They really want a space between the numbers and letters in the file size – for example: 917.4 KB, not 917.4KB. I know this is being a bit picky, but is there any way to achieve this at the moment? Or is it an option that could be quickly added to the plug-in?

Quickly added the variables %file_size_raw and %file_size_unit. Download the new version in post #1

Enjoy!

       
Andrew Macpherson's avatar
Andrew Macpherson
38 posts
15 years ago
Andrew Macpherson's avatar Andrew Macpherson
Thanks so much for this great extension, but my client has only one request that I can’t quite handle. They really want a space between the numbers and letters in the file size – for example: 917.4 KB, not 917.4KB. I know this is being a bit picky, but is there any way to achieve this at the moment? Or is it an option that could be quickly added to the plug-in?
Quickly added the variables %file_size_raw and %file_size_unit. Download the new version in post #1 Enjoy!

Hi Daniel. Thanks so much for the quick reply. I really appreciate it. The new variables are certainly going to be a great help, but I do seem to have run into one further little issue, though …

You see, when I use {file_size_raw} it doesn’t seem to be affected by the settings I have for the “filesize_precision” parameter. It used to work with the old [file_size} variable, however. The number that used to come out as 917.4KB is now coming out as 917.436523438 KB :-}

Is that something else that is easy to fix, or should it be working properly (in which case I must be doing something wrong)?

Regards Andrew Macpherson

       
Daniel Walton's avatar
Daniel Walton
553 posts
15 years ago
Daniel Walton's avatar Daniel Walton

Try again - I’ve just rectified that in the download.

       
Andrew Macpherson's avatar
Andrew Macpherson
38 posts
15 years ago
Andrew Macpherson's avatar Andrew Macpherson
Try again - I’ve just rectified that in the download.

Excellent! Thanks so much, Daniel

Cheers Andrew Mac

       
BridgingUnit's avatar
BridgingUnit
214 posts
15 years ago
BridgingUnit's avatar BridgingUnit

Just been using this on a site running PHP 5.2.9 and was getting undefined index errors when using url_only=’yes’. Did some digging and realised that parse_url was .(JavaScript must be enabled to view this email address). The solution here then seems to be to update lines 115-122 in the plugin to:

$tags['scheme'] = (isset($temp['scheme'])) ? $temp['scheme']: '';
$tags['host'] = (isset($temp['host'])) ? $temp['host'] : '';
$tags['file_path'] = (isset($temp['path'])) ? $temp['path'] : '';
$tags['port'] = (isset($temp['port'])) ? $temp['port'] : '';
$tags['query_string'] = (isset($temp['query'])) ? $temp['query'] : '';
$tags['fragment'] = (isset($temp['fragment'])) ? $temp['fragment'] : '';
$tags['user'] = (isset($temp['user'])) ? $temp['user'] : '';
$tags['pass'] = (isset($temp['pass'])) ? $temp['pass'] : '';

Hope that helps.

       
Jack Brighton's avatar
Jack Brighton
58 posts
15 years ago
Jack Brighton's avatar Jack Brighton

This is a very handy plugin for lots of things that leverage file metadata. One question about the file_size formatting: Can it be rendered in bytes instead of MB? Sometimes you want that, like in podcast feeds where machines are reading the numbers.

Thanks, Jack

       
stubear's avatar
stubear
114 posts
15 years ago
stubear's avatar stubear

This is a handy plug-in and saved me a lot of trouble but I’m using the file size on a different project and for some reason it’s not showing up. Here’s the code for my links:

{exp:zm_extract_url_plus url_only="yes" url="{case_study_file}"}
    <a href="http://{full_url}" title="download {file_name}">{file_name}</a> ({file_size} {extension})
{/exp:zm_extract_url_plus}
       
Andrew Macpherson's avatar
Andrew Macpherson
38 posts
15 years ago
Andrew Macpherson's avatar Andrew Macpherson

This always worked wonderfully well under EE1 … but the times they are a’changin’. Any chance of an update for EE2? 😉

Cheers Andrew

       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.