Got a starnge problem (to me) that hopefully one of you fine chaps can solve for me. I have a macro that I copied from a 3 installation and modified it (hopefully correctly) to be used in 4.5.2.
When the macro runs, the getmedia filename ouput has a string appended to it and the image cannot be found in the html..
Right now you are grabbing the entire Media XML with GetMedia, which includes umbracoBytes and umbracoExt (the two strings you see at the end of your file). You should just grab the umbracoFile element in this case
GetMedia problem
Hi
Got a starnge problem (to me) that hopefully one of you fine chaps can solve for me.
I have a macro that I copied from a 3 installation and modified it (hopefully correctly) to be used in 4.5.2.
When the macro runs, the getmedia filename ouput has a string appended to it and the image cannot be found in the html..
Code is
<xsl:if test="string-length(/macro/Image) > 0">
<div id="InfoBoxImage" style="background-color:#F0F0F0;width:223px;">
<xsl:if test="string-length(/macro/ImageURL) > 0">
<a href="{/macro/ImageURL}">
<img style="width: 223px; height: 100px;">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($MediaID, 0)" />
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="/macro/title" />
</xsl:attribute>
</img>
</a>
</xsl:if>
And the view source of the webpage shows the png filename as
src="/media/22/fw_new_callout_01.png223557543png"
Its the 223557543png bit that is appended (which is the concatenated width/height/size/type of the image).
How do I prevent that happening?
Cheers
Dave
Hi Dave,
You should change your GetMedia call to the following
Right now you are grabbing the entire Media XML with GetMedia, which includes umbracoBytes and umbracoExt (the two strings you see at the end of your file). You should just grab the umbracoFile element in this case
Hope this helps,
Tom
Hi,
I'm not 100% sure what your code is doing and where '$MediaID' is coming from.
However if /macro/image is a image picker then try this:
<xsl:variable name="mediaId" select="number(/macro/Image)" />
<xsl:if test="$mediaId > 0"> <xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" /> <xsl:if test="$mediaNode/umbracoFile"> <img src="{$mediaNode/umbracoFile}" height="{umbracoHeight}" width="{umbracoWidth}" /> </xsl:if> </xsl:if>
Rich
@Tom - Thanks for that - you saved me from tearing out what is left of my hair!
is working on a reply...