Skip to content

Instantly share code, notes, and snippets.

@modmedia
Created January 9, 2014 18:55
Show Gist options
  • Save modmedia/8339802 to your computer and use it in GitHub Desktop.
Save modmedia/8339802 to your computer and use it in GitHub Desktop.
Method on displaying Mura extended attribute images, including custom image sizes
<!--- Assuming you've created an extended attribute 'File' type called 'extAttributeImage' --->
<!--- In a Mura Page Template --->
#$.createHREFForImage(filename=$.content('extAttributeImage'),size='myCustomSize')#
<!--- In a Mura Component --->
#$.createHREFForImage(filename=$.component('extAttributeImage'),size='myCustomSize')#
<!--- In the context of an iterator --->
#$.createHREFForImage(filename=item.getExtAttributeImage(),size='myCustomSize')#
@PeterBowater
Copy link

Hi!

I know this was a long while ago, just wanted to say I stumbled across this when double-checking how to do this, took me a while to realise that it should actually be using the 'fileid' variable name rather than 'filename', otherwise you get a blank return from the function.

This is in the latest Mura 7, so appreciate things are very different now than 3 years ago :)

Cheers,

Peter

@rodionbykov
Copy link

Hello,

you are correct, in Mura 7 to get image url from with extended attribute image:
$.createHREFForImage(fileid = item.getValue('extAttributeImage'))

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment