Copied to clipboard

Flag this post as spam?

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


  • Shannon 148 posts 171 karma points
    Jan 27, 2011 @ 17:26
    Shannon
    0

    After upgrading to 4.6.1, I'm confused about Image Cropper and Retreving Images

    In 4.5.2  I could upload images directly into the Media section from B4U using the upload Datatype. Now when I upload files, they get uploaded into the correct foldler and cropped but do not appear in the Media Section. In addidtion, I believe that some of the code has been changed. I use to use the following in my blog roll to show cropped images as part of my front page. If anyone could advice on how to get this back working, that would be great. I followed the instructions and the video from Image Cropper. http://www.youtube.com/watch?v=cVVD60NHMRk

     

    <?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"
      xmlns:tagsLib="urn:tagsLib"
      xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
      xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml umbraco.library tagsLib Exslt.ExsltStrings BlogLibrary">


      <xsl:output method="html" omit-xml-declaration="yes"/>

      <xsl:param name="currentPage"/>
      <xsl:variable name="numberOfPosts" select="15"/>

      <xsl:variable name="pageNumber">
        <xsl:choose>
          <xsl:when test="umbraco.library:RequestQueryString('page') &lt;= 0 or string(umbraco.library:RequestQueryString('page')) = '' or string(umbraco.library:RequestQueryString('page')) = 'NaN'">1</xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="umbraco.library:RequestQueryString('page')"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="filter">
        <xsl:choose>
          <xsl:when test="string-length(umbraco.library:Request('filterby')) &gt; 0">
            <xsl:value-of select="umbraco.library:Request('filterby')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="''"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:variable name="numberOfRecords">
        <xsl:choose>
          <xsl:when test="$filter = ''">
            <xsl:value-of select="count($currentPage/ancestor-or-self::* [@isDoc]/Blog [@isDoc]//BlogPost)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="count($currentPage/ancestor-or-self::* [@isDoc]/Blog [@isDoc]//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))])"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>

      <xsl:template match="/">
        <xsl:if test="$filter = ''">
          <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc]/Blog [@isDoc]//BlogPost">
            <xsl:sort select="./PostDate" order="descending" />
            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and position() &lt;= number($numberOfPosts * (number($pageNumber)-1) + $numberOfPosts )">
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>     
            </xsl:if>       
          </xsl:for-each>
        </xsl:if>
        <xsl:if test="$filter != ''">
          <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc]/Blog [@isDoc]//BlogPost [contains(Exslt.ExsltStrings:lowercase(./tags), Exslt.ExsltStrings:lowercase($filter))]">
            <xsl:sort select="./PostDate" order="descending" />
            <xsl:if test="position() &gt; $numberOfPosts * (number($pageNumber)-1) and position() &lt;= number($numberOfPosts * (number($pageNumber)-1) + $numberOfPosts )">
              <xsl:call-template name="showpost">
                <xsl:with-param name="post" select="."/>
              </xsl:call-template>
            </xsl:if>
          </xsl:for-each>
        </xsl:if>
      </xsl:template>
     
        <xsl:template name="showpost">
         
        <xsl:param name="post"/>
        <div class="content_box">
          <xsl:if test="blogImage != ''">
            <xsl:variable name="crop" select="umbraco.library:GetMedia(blogImage, 0)/crops/crops/crop [@name='NewsThumbnail']" />
              <xsl:if test="$crop/@url != ''">
                <a href="{umbraco.library:NiceUrl(@id)}"><img src="{$crop/@url}" alt="{@nodeName}" class="img"  /></a>
              </xsl:if>
            </xsl:if>
          <div class="leftfromimage">
          <h4>
            <a href="{umbraco.library:NiceUrl($post/@id)}" title="Permalink to {$post/@nodeName}">
              <xsl:value-of select="$post/@nodeName"/>
            </a>
          </h4>
            <span class="posted"><small> Posted at <i><xsl:value-of select="umbraco.library:FormatDateTime($post/PostDate, 'h:mm tt, dddd MMMM d, yyyy')"/></i></small> by <xsl:value-of select="$post/@creatorName"/>
            <small><br />{
              <xsl:variable name="numberofcomments" select="count(BlogLibrary:GetCommentsForPost($post/@id)//comment)"/>
              <xsl:choose>
                <xsl:when test="$numberofcomments = 1">
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">1 comment</a>
                </xsl:when>
                <xsl:otherwise>
                  <a href="{umbraco.library:NiceUrl(@id)}#comments">
                    <xsl:value-of select="$numberofcomments"/> comments
                  </a>
                </xsl:otherwise>
              </xsl:choose> &amp; <xsl:choose>
                <xsl:when test="$post/pageViewCount= 1">1 pageviews
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="$post/pageViewCount"/> pageviews             
                </xsl:otherwise>
              </xsl:choose>}</small>
          </span>
          <span class="tags"><xsl:variable name="tags" select="tagsLib:getTagsFromNode(@id)" />
              <xsl:choose>
                <xsl:when test="count($tags/tags/tag) = 0">
                  Not tagged
                </xsl:when>
                <xsl:otherwise>
                  TAGS:
                  <xsl:for-each select="$tags/tags/tag">
                    <a href="{umbraco.library:NiceUrl($currentPage/ancestor-or-self::* [@isDoc]/Blog [@isDoc]/@id)}?filterby={.}" rel="tag">
                      <xsl:value-of select="."/>
                    </a>
                    <xsl:if test="position() != last()">, </xsl:if>
                  </xsl:for-each>
                </xsl:otherwise>
              </xsl:choose>
            </span>
            <xsl:value-of select="substring($post/bodyText,1,420)" disable-output-escaping="yes"/>...
            <a href="{umbraco.library:NiceUrl(@id)}" class="full_story">full story</a>
        </div>
        </div>
            <xsl:if test="position() = 3"><object data="frontpage_blogrool_center_top_728x90" type="text/html" width="733" height="95"></object></xsl:if>
          <xsl:if test="position() = 12"><object data="frontpage_blogrool_center_bottom_728x90" type="text/html" width="733" height="95"></object></xsl:if>
      </xsl:template>
    </xsl:stylesheet>
  • Shannon 148 posts 171 karma points
    Jan 27, 2011 @ 20:13
    Shannon
    0
          <xsl:if test="blogImage != ''">
            <xsl:variable name="crop" select="umbraco.library:GetMedia(blogImage, 0)/crops/crops/crop [@name='NewsThumbnail']" />
              <xsl:if test="$crop/@url != ''">
                <a href="{umbraco.library:NiceUrl(@id)}"><img src="{$crop/@url}" alt="{@nodeName}" class="img"  /></a>
              </xsl:if>
            </xsl:if>

     

            <xsl:if test="blogImage != ''">
              <xsl:variable name="crop" select="umbraco.library:GetMedia(blogImage, 0)/crops/crops/crop [@name='NewsBanner']" />
              <xsl:if test="$crop/@url != ''">
                <a href="{umbraco.library:NiceUrl(@id)}"><img src="{$crop/@url}" alt="{@nodeName}" title="#htmlcaption{@id}"  /></a>
      </xsl:if>
  • Shannon 148 posts 171 karma points
    Jan 28, 2011 @ 00:45
    Shannon
    0

    I edited the Image Cropper datatype to the following and gave the Property alias "umbracoFile"

    Then I edited the Image media type to include the Image Cropper:

    I also went into the Blog Post Document type and added Image Cropper and upload with the alias "umbracoFile"

    For the 5 test blog post I have, they include the same image as the uploaded blog image:

     

    When I run the following XML File http://www.pastie.org/private/ccitwk5zysfofc9ezbda I changed blogImage to umbracoFile and get the error I listed above. When I use blogImage, the XSLT file saves but nothing appears.

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 28, 2011 @ 20:20
Please Sign in or register to post replies

Write your reply to:

Draft