I'm using the image cropper to define the image properties that I have. All of these images have height and width but only the image is displaying, the height and width are empty.
I'm not sure what i'm missing from my XSLT. Can someone help me out with the syntax please?
Hmm, that's odd. They are stored as properties on the media node itself, just like a property on a document. Try going to the Media section, finding that image and seeing if the Height & Width are filled out there. Or is this perhaps a custom media type? If so you'll need to add the properties manually (see the Image media type for the list of them).
If they are showing in the backoffice correctly, try adding this right before the <img> tag, this will dump out the media's raw XML and you can see if the properties are filled out there.
media assets showing, height and width are empty?
Hi There,
I'm using the image cropper to define the image properties that I have. All of these images have height and width but only the image is displaying, the height and width are empty.
I'm not sure what i'm missing from my XSLT. Can someone help me out with the syntax please?
Thanks in advance.
Sean
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="mediaId" select="number($currentPage/imageRightPromo)" />
<xsl:if test="$mediaId > 0">
<xsl:variable name="mediaNode" select="umbraco.library:GetMedia($mediaId, 0)" />
<xsl:if test="$mediaNode/umbracoFile">
<img src="{$mediaNode/umbracoFile}" alt="[image]" height="{umbracoHeight}" width="{umbracoWidth}" />
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Sean,
It looks like the properties (umbracoHeight, umbracoWidth) are missing the $mediaNode variable before them, try:
-Tom
Hi Tom, that does not seem to work at all. They are still showing as:
Are they stored in a file or db when they are uploaded?
<img height="" width="" alt="[image]" src="/media/5022/image.jpg">
Hmm, that's odd. They are stored as properties on the media node itself, just like a property on a document. Try going to the Media section, finding that image and seeing if the Height & Width are filled out there. Or is this perhaps a custom media type? If so you'll need to add the properties manually (see the Image media type for the list of them).
If they are showing in the backoffice correctly, try adding this right before the <img> tag, this will dump out the media's raw XML and you can see if the properties are filled out there.
-Tom
Hi Tom,
That's a really great trick. I must have been looking at the wrong image. Worked like a treat.
Thanks again
<Image id="1269" version="fcc1a439-03b8-4109-839f-e6cfd624e799" parentID="-1" level="1" writerID="0" nodeType="1032" template="0" sortOrder="85" createDate="2011-04-06T17:56:44" updateDate="2011-04-06T17:56:43" nodeName="imageFeatureSecondFromLeft" urlName="imagefeaturesecondfromleft" writerName="admin" nodeTypeAlias="Image" path="-1,1269"><umbracoFile>/media/2874/image.jpg</umbracoFile><umbracoWidth>170</umbracoWidth><umbracoHeight>116</umbracoHeight><umbracoBytes>12401</umbracoBytes><umbracoExtension>jpg</umbracoExtension><imageCropper></imageCropper></Image>
is working on a reply...