Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ricardo Gomes 22 posts 42 karma points
    Oct 27, 2009 @ 10:39
    Ricardo Gomes
    0

    Image from media picker as background of table

    hello community,

    I'd like to use an image that the user inserts through a mediapicker as the background of a table, could anyone tell how to do it?

    or in a more generic way, how to get the image or media path to get the file of the media file that the user has inserted in the content area.

    thanks in advance,

    Regards,

    Ricardo

  • dandrayne 1138 posts 2262 karma points
    Oct 27, 2009 @ 11:04
    dandrayne
    0

    Here's a short macro to get the current page banner (assuming it's stored in a mediapicker property of 'pageBannerImage'

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <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:if test="$currentPage/data [@alias='pageBannerImage'] != ''">
    <div class="page_header">
    <img alt="{$currentPage/@nodeName}">
    <xsl:attribute name="src">
    <xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='pageBannerImage'], 'false')/data [@alias = 'umbracoFile']" />
    </xsl:attribute>
    </img>
    </div>
    </xsl:if>

    </xsl:template>

    </xsl:stylesheet>

    Now to set as a background

       <xsl:if test="$currentPage/data [@alias='pageBannerImage'] != ''"> 
    <div>
    <xsl:attribute name="style">
    <xsl:text>background:url(</xsl:text><xsl:value-of select="umbraco.library:GetMedia($currentPage/data [@alias='pageBannerImage'], 'false')/data [@alias = 'umbracoFile']" /><xsl:text>) left top repeat-x;</xsl:text>
    </xsl:attribute>
    </div>
    </xsl:if>

    or something to that effect!

    Dan

Please Sign in or register to post replies

Write your reply to:

Draft