Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I would like to load an image from media and use it inline style.
My code (not working):
<body style="background: url(<umbraco:Item runat="server" field="siteBG" recursive="true" xslt="concat(''', umbraco.library:GetMedia({0},'true')/ data[@alias='umbracoFile'], ''')" XsltDisableEscaping="true" />)">
Result: <body style="background: url('')">
<body style="background: url(<umbraco:Item runat="server" field="siteBG" recursive="true" xslt="concat('"', umbraco.library:GetMedia({0},'true')/ data[@alias='umbracoFile'], '"')" XsltDisableEscaping="true" />)">
Result: <body style="background: url("/media/1/2.jpg")">
I think it has to do with xml-escaping...
Perhaps someone could enlighten me - or is it possible to do this?
Site is running 4.0.2.1
/Henrik
Hi Henrik,
I think you'll have to include <body style="background: url()"> into the xslt part of the umbraco item. It won't look nice nor readable, but might work.
Cheers,
/Dirk
Perfect it worked :)
Thanks a lot
/henrik
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Load an image from media and use it inline style?
I would like to load an image from media and use it inline style.
My code (not working):
<body style="background: url(<umbraco:Item runat="server" field="siteBG" recursive="true" xslt="concat(''', umbraco.library:GetMedia({0},'true')/ data[@alias='umbracoFile'], ''')" XsltDisableEscaping="true" />)">
Result: <body style="background: url('')">
<body style="background: url(<umbraco:Item runat="server" field="siteBG" recursive="true" xslt="concat('"', umbraco.library:GetMedia({0},'true')/ data[@alias='umbracoFile'], '"')" XsltDisableEscaping="true" />)">
Result: <body style="background: url("/media/1/2.jpg")">
I think it has to do with xml-escaping...
Perhaps someone could enlighten me - or is it possible to do this?
Site is running 4.0.2.1
/Henrik
Hi Henrik,
I think you'll have to include <body style="background: url()"> into the xslt part of the umbraco item. It won't look nice nor readable, but might work.
Cheers,
/Dirk
Perfect it worked :)
Thanks a lot
/henrik
is working on a reply...