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
hey all. i used umbraco a while back but just recently decided to try this new version.but now pictures wont show that i have pulled from my media folder as such.<umbraco:Item runat="server" field="mediapicker1" xslt="concat('<img class="sidelogo" src="', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '"alt="', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '"/>')" xsltDisableEscaping="true" />has something changed or am i doing it wrong / or is there a easier way now with new version ?thanx.
there is a new xml schema, so to get the image instead of
umbraco.library:GetMedia(mediaId, 'true')/data[@alias='umbracoFile']
all you need to do is
umbraco.library:GetMedia(mediaId, 'true')/umbracoFile
hmm having problems getting it to work.. not sure whats wrong .field="mediapicker1" xslt="concat('<img class="sidelogo"src="', umbraco.library:GetMedia(mediaId, 'true')/umbracoFile, '"alt="', umbraco.library:GetMedia(mediaId, 'true')/umbracoFile, '"/>')" xsltDisableEscaping="true" />
what is wrong with this line ?
sorry, I was just using 'media' id as an example.
In your instance change
to
umbraco.library:GetMedia({0}, 'true')/umbracoFile
wow .. hehe i just cant get it working. what is the preferred way to make a mediapicker picture on a page ? cause ive tried this now and still no luck.<umbraco:Item runat="server" field="excommikon" xslt="concat('<img class="sidelogo"src="', umbraco.library:GetMedia({0}, 'true')/umbracoFile, '"alt="', umbraco.library:GetMedia({0}, 'true')/umbracoFile, '"/>')" xsltDisableEscaping="true" />
What's the actual output you are getting?
Have you tried doing up a quick xslt macro, passing in the media id and just using
to see if it gets the file out correctly?
Also, I don't think the second parameter needs to be true, you should be able to get it to work with false
am not getting any output at all - just a empty line.no . i havent tried that . but i properly wouldent know how to :( im awfully new at this.
ok i just did a <xsl:variablename="media"select="umbraco.library:GetMedia($currentPage/imageAlias, 0)"/><xsl:iftest="$media"> <imgsrc="{$media/umbracoFile}"alt="{$media/altText}"/></xsl:if>macro - worked fine....weird... this is alot easier heh....
Yep, macros are a lot easier to read/write; you don't need to worry about chaning '<' into '<'. Plus it's better practice as it allows you to seperate functionality out from your template.
thanx for the help ;)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
old method to pull out a IMG doesent work in new umbraco?
hey all.
i used umbraco a while back but just recently decided to try this new version.
but now pictures wont show that i have pulled from my media folder as such.
<umbraco:Item runat="server" field="mediapicker1" xslt="concat('<img class="sidelogo" src="', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '"alt="', umbraco.library:GetMedia({0},'true')/data[@alias='umbracoFile'], '"/>')" xsltDisableEscaping="true" />
has something changed or am i doing it wrong / or is there a easier way now with new version ?
thanx.
there is a new xml schema, so to get the image instead of
umbraco.library:GetMedia(mediaId, 'true')/data[@alias='umbracoFile']
all you need to do is
umbraco.library:GetMedia(mediaId, 'true')/umbracoFile
hmm having problems getting it to work.. not sure whats wrong .
field="mediapicker1"
xslt="concat('<img class="sidelogo"
src="', umbraco.library:GetMedia(mediaId, 'true')/umbracoFile, '"
alt="', umbraco.library:GetMedia(mediaId, 'true')/umbracoFile, '"/>')" xsltDisableEscaping="true" />
what is wrong with this line ?
sorry, I was just using 'media' id as an example.
In your instance change
umbraco.library:GetMedia(mediaId, 'true')/umbracoFile
to
umbraco.library:GetMedia({0}, 'true')/umbracoFile
wow .. hehe i just cant get it working. what is the preferred way to make a mediapicker picture on a page ?
cause ive tried this now and still no luck.
<umbraco:Item
runat="server"
field="excommikon"
xslt="concat('<img
class="sidelogo"
src="', umbraco.library:GetMedia({0}, 'true')/umbracoFile, '"
alt="', umbraco.library:GetMedia({0}, 'true')/umbracoFile, '"/>')" xsltDisableEscaping="true" />
What's the actual output you are getting?
Have you tried doing up a quick xslt macro, passing in the media id and just using
umbraco.library:GetMedia(mediaId, 'true')/umbracoFile
to see if it gets the file out correctly?
Also, I don't think the second parameter needs to be true, you should be able to get it to work with false
am not getting any output at all - just a empty line.
no . i havent tried that . but i properly wouldent know how to :( im awfully new at this.
ok i just did a
<xsl:variablename="media"select="umbraco.library:GetMedia($currentPage/imageAlias, 0)"/>
<xsl:iftest="$media">
<imgsrc="{$media/umbracoFile}"alt="{$media/altText}"/>
</xsl:if>
macro - worked fine....weird... this is alot easier heh....
Yep, macros are a lot easier to read/write; you don't need to worry about chaning '<' into '<'. Plus it's better practice as it allows you to seperate functionality out from your template.
thanx for the help ;)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.