This plugin has been rebuilt. Please visit this thread for version 2.
Written solely for the purpose of getting filenames from custom fields populated by the upload form in publish, this plugin can be used to display file type, path, domain, description and many other properties of the URL it finds.
Example usage:
{exp:extract_url_plus show="% filename.% extension (% filesize)"}
Some text, etc etc
<a href="http://www.example.com/directory/myphoto.jpg">My file</a>
Some more text?
{/exp:extract_url_plus}
REMOVE SPACE BETWEEN % AND VARIABLE NAME
This would return:
myphoto.jpg (4.87KB)
Available formatting variables to use within the “show” parameter are listed:
% fullurl - The full url (e.g., “http://www.example.com/directory/myphoto.jpg”) % protocol - (e.g., “http” / “https” / “ftp” / “ftps”) % subdomain - (e.g., “www”) % domain - (e.g., “example”) % tld - (e.g., “com”) % ip - If the hostname is an IP address, it is available in this variable. % path - (e.g., “directory/”) % filename - (e.g., “myphoto”) % extension - (e.g., “jpg”) % fullfilename - (e.g., “myphoto.jpg”) % hostname - If an IP address, this will be identical to the ip; variable, if not it might contain e.g., “www.ecample.com” % description - A brief description of the file, based on extension type. This can be customised in the plugin file if needed % filesize - Shows a readable filesize with unit denomination. To use this feature you may need to open the plugin file and edit the line that looks like: var $docpath = ‘/var/www/html/’;
If you are upgrading from an older version: The plugin will still honour the show parameter with a single variable, without the % sign.
Version 1.3.1
Hi there,
Just came across this thread due to your other thread where people were asking for this functionality. Just to say thanks for the plugin but I was reading the documentation by going to the plugins section on my site and it said :
show=”xyz”
I was just wondering what this means? Do I have to place something specific in there for it to work such as the field name?
Thanks for any help with this and thanks for creating the plugin in the first place!
Best wishes,
Mark
I tried this plugin (to understand what it can)
I wrote:
<b>filename: </b>
{exp:extract_url_plus show="filename"}
http://www.example.com/files/testing/test.zip
{/exp:extract_url_plus}
<br><br>
according to:
{exp:extract_url_plus show="xyz"} etc.. {/exp:extract_url_plus}
But I got:
filename: www.example.com
Not ‘test’.
Can I ask…is there a way to make this extension do a ‘relative’ URL extraction, or a file name with extension?
For example:
{exp:extract_url_plus show="relative"}{img_file}{/exp:extract_url_plus}
Would output: /images/img.jpg rather than http://www.mysite.com/images/img.jpg. I guess just lopping off the host? This will make this plugin a little friendlier with phpthumb.
Also, what about the full file?
{exp:extract_url_plus show="fullfilename"}{img_file}{/exp:extract_url_plus}
Would output: img.jpg rather than img. I can work around this using the show=”extension” coupled with show=”filename”, but the code is a little ungainly.
I’ve thought to myself, previously, that it would be alot more functional to pass the plugin say a “display” parameter with a value such as “path filename” which would then show exactly that, path followed by filename. One day, i will do it!
For now though i will quickly bodge in those two other show values, Give me a second.
How do I have this show more than one parameter? Like so:
{exp:extract_url_plus show="filename|extension"}http://www.website.com/images/image.jpg{/exp:extract_url_plus}
which would give: image.jpg
I cannot seem to get multiple parameters to work. Is this possible? What’s the correct syntax?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.