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
Hi all,
I have a media picker and I am trying to display using Lee's advice from his blog, I have this:
<xsl:variable name="mediaId" select="number($currentPage/data[@alias='jobPostingBusinessUnitLogo'])" />
<xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="count($mediaNode/data) > 0 and string($mediaNode/data[@alias='umbracoFile']) != ''"> <img src="{$mediaNode/data[@alias='umbracoFile']}" alt="[image]" height="{$mediaNode/data[@alias='umbracoHeight']}" width="{$mediaNode/data[@alias='umbracoWidth']}" /> </xsl:if> </xsl:if>
I'm not getting any output and if I do a value-of on mediaId I get NaN. I've checked the field in the umbraco.config:
<jobPostingBusinessUnit><![CDATA[NEC Group]]></jobPostingBusinessUnit> <jobPostingBusinessUnitLogo>1230</jobPostingBusinessUnitLogo> <jobPostingClosingDate>2011-10-24T00:00:00</jobPostingClosingDate> <jobPostingJobType><![CDATA[Permanent]]></jobPostingJobType> <jobPostingSalary>24,000</jobPostingSalary> <jobPostingPaymentSchedule><![CDATA[]]></jobPostingPaymentSchedule>
and it exists and is a number.
Thanks
Hi, Darryl. What schema version do you use? This xslt seems to target the old one.
4.7.0 Rodion
1.0 XML
Try to change your script to something like this:
<xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="$mediaNode/Image/umbracoFile != ''"> <img src="{$mediaNode/Image/umbracoFile}" alt="[image]" height="{$mediaNode/Image/umbracoHeight}" width="{$mediaNode/Image/umbracoWidth}" /> </xsl:if></xsl:if>
Hi Rodion,
I hadn't noticed Lee's blog post was from 2009, we've got it working with this:
<img src="{umbraco.library:GetMedia(jobPostingBusinessUnitLogo, 0) /umbracoFile}"/>
Just need to check if an image has been selected.
Thanks for your help.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
GetMedia - not working
Hi all,
I have a media picker and I am trying to display using Lee's advice from his blog, I have this:
<xsl:variable name="mediaId" select="number($currentPage/data[@alias='jobPostingBusinessUnitLogo'])" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="count($mediaNode/data) > 0 and string($mediaNode/data[@alias='umbracoFile']) != ''">
<img src="{$mediaNode/data[@alias='umbracoFile']}" alt="[image]" height="{$mediaNode/data[@alias='umbracoHeight']}" width="{$mediaNode/data[@alias='umbracoWidth']}" />
</xsl:if>
</xsl:if>
I'm not getting any output and if I do a value-of on mediaId I get NaN. I've checked the field in the umbraco.config:
and it exists and is a number.
Thanks
Hi, Darryl. What schema version do you use? This xslt seems to target the old one.
4.7.0 Rodion
1.0 XML
Try to change your script to something like this:
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode"
select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/Image/umbracoFile != ''">
<img src="{$mediaNode/Image/umbracoFile}" alt="[image]"
height="{$mediaNode/Image/umbracoHeight}"
width="{$mediaNode/Image/umbracoWidth}" />
</xsl:if>
</xsl:if>
Hi Rodion,
I hadn't noticed Lee's blog post was from 2009, we've got it working with this:
<img src="{umbraco.library:GetMedia(jobPostingBusinessUnitLogo, 0) /umbracoFile}"/>
Just need to check if an image has been selected.
Thanks for your help.
is working on a reply...