Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Created August 16, 2013 20:07
Show Gist options
  • Save stevewithington/6253117 to your computer and use it in GitHub Desktop.
Save stevewithington/6253117 to your computer and use it in GitHub Desktop.
Mura CMS : Mura has two different methods for get a link to a file stored as an extended attribute. The one you choose depends on if you're expecting the file to be an "image" or a "file" ... if it's not a valid image or file, then the methods will return an empty string, which means you can test for the return value and then output it if it exi…
<cfscript>
// simple examples
fileURL = $.getURLForFile('yourFileID');
imageURL = $.getURLForImage('yourFileID');
</cfscript>
<!--- File Example --->
<cfif Len($.getURLForFile($.content('myCustomAttribute')))>
<a href="#$.getURLForFile($.content('myCustomAttribute'))#">Download File</a>
<cfelse>
Not a valid FILE or it doesn't exist.
</cfif>
<!--- Image Example --->
<cfif Len($.getURLForImage($.content('myCustomAttribute')))>
<img src="#$.getURLForFile($.content('myCustomAttribute'))#" />
<cfelse>
Not a valid IMAGE or it doesn't exist.
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment