getMedia, Value was either too large or too small for an Int32.
Hi, I know there are a few topics about this, but the solutions are not working for me.
I have a documenttype with an upload field.
I have a XSLT script to display newsitems with image. When i do not have an image then all works fine, when i upload an image i get the error above. It´s failing on the code below:
To avoid this error you typically test to see if the media picker property is empty. It looks like you are doing that for newsImage but not for bannerImage? Are you maybe mixing up the two names?
Try..
<xsl:choose> <xsl:when test="current()/bannerImage != ''"> <xsl:variable name="media" select="umbraco.library:GetMedia(current()/bannerImage, 'false')" /> <img src="{$media/umbracoFile}" alt="klik hier voor het nieuwsbericht" width="84" border="0"/> </xsl:when> <xsl:otherwise> <img src="/media/6468/empty.png" alt="" width="84" border="0"/> </xsl:otherwise> </xsl:choose>
If you are using a upload data type, then you shall not use the GetMedia-extension. The upload data type returns the path to the image directly to you, so that could be a reason to why the extension fails.
getMedia, Value was either too large or too small for an Int32.
Hi, I know there are a few topics about this, but the solutions are not working for me.
I have a documenttype with an upload field.
I have a XSLT script to display newsitems with image. When i do not have an image then all works fine, when i upload an image i get the error above. It´s failing on the code below:
Does sombody can help me with this.?
Thank you. Kind regards,
Ad
Hi,
To avoid this error you typically test to see if the media picker property is empty. It looks like you are doing that for newsImage but not for bannerImage? Are you maybe mixing up the two names?
Try..
Thanks,
Tom
Thank you. I had pasted a solution but did not alter the names... but when i change the names it still wont work...
Hi,
Are you still getting the error or is the image just not showing?
Is the correct property bannerImage or newsImage?
Is this code running inside a for-each loop?
-Tom
Hi Ad
If you are using a upload data type, then you shall not use the GetMedia-extension. The upload data type returns the path to the image directly to you, so that could be a reason to why the extension fails.
/Kim A
Thank you, that was it.. just referenced the field and it worked like a charm... Got a lot to learn...
Great to hear that you got things worked out Ad.
Sometimes it can be a good idea to print out the currentPage to see how the XML looks. You can do this like this:
/Kim A
Great Tip! tnx
Yeah, it gives you a good idea on what to do with the different data.
For this purpose you could maybe also try out the XML Dump package from Chriztian Steinmeier. But the textarea-trick does a great job as well :)
/Kim A
is working on a reply...