Copied to clipboard

Flag this post as spam?

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


  • Amigo 245 posts 600 karma points
    Dec 13, 2010 @ 15:53
    Amigo
    0

    image picker

    Im new to umbraco.

    When using image picker from scratch it only shows an id when rendered in a template from my propperty.

    I wish to use the mediapicker with same structure in several proppertyes on my pages.

    What will i have to do to get my images rendered with:

    link on my image
    tooltip on the link
    image

    i use the latest version.

  • Rich Green 2246 posts 4008 karma points
    Dec 13, 2010 @ 16:41
    Rich Green
    0

    Hey Amigo,

    The media picker just returns a node ID, so you need to add some xslt to pull out the media item

    <xsl:template match="/">
        <xsl:variable name="mediaId" select="number($currentPage/mediaId)" />
        <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>

    If the tooltip & link are *always* going to be the same for whenever the image is going to be displayed then you can add extra properties to the image:

    Go to Settings - Media Types and then 'Generic Properties' you can then add a field for toolTip / link etc.

    You would simply access these in the same way, instead of $mediaNode/umbracoFile you would just use $mediaNode/toolTip or $mediaNode/imageLink etc.

    Hope this helps

    Rich

     

  • Amigo 245 posts 600 karma points
    Dec 13, 2010 @ 17:14
    Amigo
    0

    Thanks Rich,

    So i need to create a xslt file and macro, and then insert the macro arround in my templates?
    I have created "generic propperties" for image (mediapicker), tooltip (textstring) and link (textstring) on my pages... they have to be unique.
    Can i use the same aliasname to all of them?

  • Amigo 245 posts 600 karma points
    Dec 14, 2010 @ 11:53
    Amigo
    0

    ok Rich i got the idea.

    Thanks for help ;-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies