Copied to clipboard

Flag this post as spam?

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


  • trfletch 598 posts 604 karma points
    Jun 09, 2010 @ 18:39
    trfletch
    0

    Check if media has been deleted

    Hi All,

    I have an Umbraco V4 website and I am trying implement a gallery using Content flow (http://www.jacksasylum.eu/ContentFlow/). I am using the Related Media datatype (http://www.nibble.be/?p=64) that works in a similar way to the Related Links datatype built into Umbraco. I have managed to get it working ok using the following XSLT but I want to build in some sort of fault tolerance to make sure it still works if the user deletes the image from the media section but does not remove it from the Related Media picker on the node. The way I see it they could either delete the media item completely or just click the "Remove file" checkbox and click save. Either method would screw up my gallery so I want to add some sort of IF statement in to check that the media file exists before trying to display it. Can anyone help me out with this one? The code I have so far is as follows:

    <xsl:template match="/">
    <xsl:variable name="propertyAlias" select="string('recruiterimages')"/>

    <div class="ContentFlow">
                <div class="loadIndicator"><div class="indicator"></div></div>
                <div class="flow">
         <xsl:for-each select="$currentPage/data [@alias = $propertyAlias]/media/item">

    *****Some sort of IF statement here I would imagine but not sure what *******
     

          <img class="item">
      <xsl:attribute name="src">
       <xsl:value-of select="umbraco.library:GetMedia(./@id,'false')/data [@alias = 'umbracoFile']"/>           
      </xsl:attribute>
           </img>
         </xsl:for-each>
                </div>
                <div class="globalCaption"></div>
    <div class="scrollbar"><div class="slider"><div class="position"></div></div></div>
    </div>
    </xsl:template>
Please Sign in or register to post replies

Write your reply to:

Draft