Just starting out with Umbraco and running into a pretty standard problem (from looking around the web) - but no solutions seem to work for me at all. I'm using Umbraco 4.7.0.
Bascially what I'm trying to do is to display a html image tag for an uploaded asset, using a macro with XSLT.
I have a page structure:
- Top Level
- Client Page
- Project Page
... the asset is an "upload" property called "clientLogo" of the Client Page document type, and I want to be able to display that asset in all Client Pages and all Project Pages. The image is the client logo. Here's my XSLT:
Basically you just want to display the uploaded image right?...so you dont want the user to upload images which might break your layout as well. You could try this
Standard noob GetMedia question
Hi guys,
Just starting out with Umbraco and running into a pretty standard problem (from looking around the web) - but no solutions seem to work for me at all. I'm using Umbraco 4.7.0.
Bascially what I'm trying to do is to display a html image tag for an uploaded asset, using a macro with XSLT.
I have a page structure:
- Top Level
- Client Page
- Project Page
... the asset is an "upload" property called "clientLogo" of the Client Page document type, and I want to be able to display that asset in all Client Pages and all Project Pages. The image is the client logo. Here's my XSLT:
<xsl:template match="/">
<xsl:variable name="mediaId" select="number($currentPage/clientLogo)" />
<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>
But this outputs nothing at all. Any help MUCH appreciated, been banging my head against this all day.
Cheers,
Mark.
Hi Mark,
If I understand your explanation correct you have a property called "clientLogo" based on the upload datatype.
Maybe this will you work for you.
I havenĀ“t tested it myself, but I hope it can helps you.
May I ask why you are use the Upload data type and not the media picker datatype?
/Dennis
Hi agian Mark,
When you are using an upload data type does not allow you to use umbracoWidth and UmbracoHeight.
But take a look at uComponents and their GetImageHeight extension. You can find more about it here.
http://ucomponents.codeplex.com/wikipage?title=Media&referringTitle=Documentation
/Dennis
Hi Mark,
Basically you just want to display the uploaded image right?...so you dont want the user to upload images which might break your layout as well. You could try this
//fuji
is working on a reply...