Use of GetMedia after upgrade to 4.5 with LegacyXmlShema on
Hi,
Recently i have upgraded my Umbraco website from 4.0 to 4.5 with the UseLegacyXmlSchema setting on true.
Now i try to make some customasible content blocks with image, title and text. Unfortunately i can't get the GetMedia property work.
What is the good work-around for this?
Currently i use inline XSLT: <umbraco:Item runat="server" field="ccZwemABCImage" xslt="concat('<img src="',umbraco.library:GetMedia({0}, true())/umbracoFile, '" />')" xsltDisableEscaping="true"/>
An alternative approach would be to create an XSLT macro that outputs the IMG tag, and pass the media ID or as in this example the page property of the current page (e.g. ccZwemABCImage) to the XSLT. I have used this on Umbraco 4.0 sites that have been upgraded to 4.5.2.
Use of GetMedia after upgrade to 4.5 with LegacyXmlShema on
Hi,
Recently i have upgraded my Umbraco website from 4.0 to 4.5 with the UseLegacyXmlSchema setting on true.
Now i try to make some customasible content blocks with image, title and text. Unfortunately i can't get the GetMedia property work.
What is the good work-around for this?
Currently i use inline XSLT: <umbraco:Item runat="server" field="ccZwemABCImage" xslt="concat('<img src="',umbraco.library:GetMedia({0}, true())/umbracoFile, '" />')" xsltDisableEscaping="true"/>
Thanks,
Michael
Hey Michael,
Welcome to the forum!
Your code seems to be using the new schema? A pre 4.5 sample can be found here http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt
Something like
<umbraco:Item runat="server" field="ccZwemABCImage" xslt="concat('<img src="',umbraco.library:GetMedia({0}, true())/data[@alias='umbracoFile'], '" />')" xsltDisableEscaping="true"/>
Rich
Hi Rich,
Thank you for your comment!
Unfortunately i tried every snippet from the pages above, without result.
Hi,
What does the following return?
<umbraco:Item runat="server" field="ccZwemABCImage" />
Rich
Hi Rich,
That snippet returns the image ID.
Michael
Hi Michael,
Can you try this instead
Hi Fuji,
That unfortunately leaves a empty <img src="" /> too.
Michael
An alternative approach would be to create an XSLT macro that outputs the IMG tag, and pass the media ID or as in this example the page property of the current page (e.g. ccZwemABCImage) to the XSLT. I have used this on Umbraco 4.0 sites that have been upgraded to 4.5.2.
I have decided to use the new XML schema and everything is fine now with the code below:
Thanks for your comments!
Hi Michael,
Well good to hear you got it working though.
is working on a reply...