Copied to clipboard

Flag this post as spam?

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

  • Rik Helsen 670 posts 873 karma points
    Nov 03, 2010 @ 20:22
    Rik Helsen

    Imagegen image used in lightbox appears as raw data instead of an image?

    I have a strange issue... all clues/help appreciated!

    I have a mediapicker property on a page that selects an album in the media section, all images below are listed as thumbs (works nicely), and also shown as a larger version in a lightbox.

    Link to the resized image:

    Screenshot of the same image shown in the lightbox:


    xslt code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
    Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
    Exslt.ExsltSets "

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

    <xsl:param name="currentPage"/>
    <xsl:variable name="mediapickerproperty" select="$currentPage/imageLibrary"/> <!-- datatype property for the mediapicker -->
    <xsl:variable name="bigW" select="700"/> <!-- max width of lightbox popup image in pixels -->
    <xsl:variable name="bigH" select="700"/> <!-- max height of lightbox popup image in pixels -->   
    <xsl:template match="/">

      <xsl:if test="$mediapickerproperty &gt; 0">
        <xsl:variable name="images" select="umbraco.library:GetMedia($mediapickerproperty, 1)" />
        <xsl:if test="count($images/*) &gt; 0">
          <xsl:for-each select="$images/*">
       <xsl:if test="./umbracoFile != ''">

    <div class="thumbback">
        <xsl:attribute name= "class">fancybox gallery</xsl:attribute>
        <xsl:attribute name= "rel">group</xsl:attribute>

             <xsl:when test="./umbracoWidth &lt; 700 and ./umbracoHeight &lt; 700">
          <xsl:attribute name= "href">
            <xsl:value-of select="./umbracoFile"/>
          <xsl:when test="./umbracoWidth &gt; ./umbracoHeight"> <!-- scale based on height OR width -->
          <xsl:attribute name= "href">
            /umbraco/imageGen.aspx?image=<xsl:value-of select="./umbracoFile"/>&amp;width=<xsl:value-of select="$bigW"/>&amp;constrain=true
          <xsl:attribute name= "href">
            /umbraco/imageGen.aspx?image=<xsl:value-of select="./umbracoFile"/>&amp;height=<xsl:value-of select="$bigH"/>&amp;constrain=true
        </xsl:choose<!--Small thumbnail -->
            <img src="/umbraco/ImageGen.ashx?image={./umbracoFile}&amp;height=75&amp;width=75&amp;pad=true&amp;bgcolor=ffffff" alt="{./ImgDescription}" title="{./ImgDescription}"/>    



  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Nov 03, 2010 @ 20:39
    Chriztian Steinmeier

    Woah! ASCII art :-)

    Don't know if it's causing this, but one thing you should be aware of, is the added whitespace you're getting in the href attribute - when you're assembling a value using "mixed content" (text and elements inside an element), as in this:

    <xsl:attribute name= "href">
       /umbraco/imageGen.aspx?image=<xsl:value-of select="./umbracoFile"/>&amp;width=<xsl:value-of select="$bigW"/>&amp;constrain=true
    The processor really sees this:
    <xsl:attribute name="href"><!-- This is interpreted as significant whitespace
         -->/umbraco/imageGen.aspx?image=<!-- This too!
         --><xsl:value-of select="./umbracoFile"/><!--
         --><xsl:value-of select="$bigW"/><!--

    Instead, you can do:

    <xsl:attribute name="href">
        <xsl:value-of select="umbracoFile" />
        <xsl:value-of select="$bigW"/>
    Or (my preferred way):
    <xsl:attribute name="href">
        <xsl:value-of select="concat('/umbraco/imageGen.aspx?image=', umbracoFile, '&amp;width=', $bigW, '&amp;constrain=true')" />



  • Rik Helsen 670 posts 873 karma points
    Nov 03, 2010 @ 20:39
    Rik Helsen

    Nevermind, got it, it's a bug in the newer version of FancyBox, 1.3.1 has issues with images not ending on .jpg

  • Rik Helsen 670 posts 873 karma points
    Nov 03, 2010 @ 20:46
    Rik Helsen

    btw, thanks chriztian for the xslt tutorial :) (I didn't see your remark when i posted the reply above)

    As for the solution in my case,

        'type' : 'image' was not set in the fancybox declaration, and in this newer version of the script it doesn't assume it's an image if the url doesn't end on .jpg or something alike...

    <script type="text/javascript">
    $(document).ready(function() {     

        'type' : 'image',
        'titlePosition'  : 'over'

  • Johan 188 posts 380 karma points
    Feb 07, 2011 @ 16:48

    I had this exact problem but with colorbox. There is no way to declare file type in Colorbox so i did a quick-and-dirty-hack. I just added a query string that ended on .jpg at the end.


  • geoff 1 post 22 karma points
    Jul 24, 2013 @ 15:54

    dude johan i love you man


Please Sign in or register to post replies

Write your reply to: