Get media id from mediaCurrent macro parameter type
Hi,
I have a macro which takes two parameters - both mediaCurrent data types. Both of these are used to load images into the macro.
The values are being passed through okay, but instead of media id the mediaCurrent data type seems to send a full string of the media item e.g. 'media/987/mypic.png801075259png'. I just need the first part (the file path).
Question is, how to I get just the file path out of this? I expected the output of a mediaCurrent data type to be in XML, but if I output the value into a <textarea></textarea> it still just shows as a string it seems, so I'm a little confused how to deal with it, other than some really hacky XSLT regular expression or string manipulation.
Suggestion: do an xsl:copy-of of the mediaCurrent, that will show you all the xml structure underneath, so you can define the Xpath you'll need. I think it will turn out to be a "/umbracoFile" xpath.
Get media id from mediaCurrent macro parameter type
Hi,
I have a macro which takes two parameters - both mediaCurrent data types. Both of these are used to load images into the macro.
The values are being passed through okay, but instead of media id the mediaCurrent data type seems to send a full string of the media item e.g. 'media/987/mypic.png801075259png'. I just need the first part (the file path).
Question is, how to I get just the file path out of this? I expected the output of a mediaCurrent data type to be in XML, but if I output the value into a <textarea></textarea> it still just shows as a string it seems, so I'm a little confused how to deal with it, other than some really hacky XSLT regular expression or string manipulation.
Thanks
Hi Dan,
The mediaCurrent type returns the entire XML for the Media Item, you'll see this if you do a <xsl:copy-of... into a textarea.
To get just the file path:
-Tom
Hi
Suggestion: do an xsl:copy-of of the mediaCurrent, that will show you all the xml structure underneath, so you can define the Xpath you'll need. I think it will turn out to be a "/umbracoFile" xpath.
/HFS
is working on a reply...