Copied to clipboard

Flag this post as spam?

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


  • Frederik T 234 posts 345 karma points
    Aug 10, 2011 @ 13:50
    Frederik T
    0

    Imagegen query string parameters doesnt work

    Hope the title isnt misleading, but didnt know how else ot explain it.

     

    So i have this:

    <xsl:if test="count(current()/outputPictures) > 0">
    <img src="{current()/outputPictures[position()=1]/DAMP[@fullMedia]/mediaItem/Image/umbracoFile}" width="125" height="70"/>
    </xsl:if>

    the source is a large picture that will be resized to a thumbnail and used a link, the code above works but it isnt resized so in comes imagegen:

    <xsl:if test="count(current()/outputPictures) > 0">
    <img src="/umbraco/ImageGen.ashx?image={current()/outputPictures[position()=1]/DAMP[@fullMedia]/mediaItem/Image/umbracoFile}" width="125" height="70"/>
    </xsl:if>

    And that works as well, but as you can see it isnt resizing anything, but when i do this:

    <xsl:if test="count(current()/outputPictures) > 0">
      <img src="/ImageGen.ashx?image={current()/outputPictures[position()=1]/DAMP[@fullMedia]/mediaItem/Image/umbracoFile}&width=125" width="125" height="70"/>
    </xsl:if>

    It doesnt work, regardless of what parameter i add it gives this exception:

    System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 35, position 131.

    The line its refering to is the line where imagegen is used, the one above.

     

    Im at total loss right now. I tought i should refer to a class in the imagegen config file instead, but that doesnt work either, just parameters in general doesnt work. I might have overseen something...

  • Frederik T 234 posts 345 karma points
    Aug 10, 2011 @ 13:55
    Frederik T
    0

    Sorry for double posting, but it wont let me edit my post for some reason, but the second code snippet says "

    <imgsrc="/umbraco/ImageGen.ashx...

    and the third says

    <imgsrc="/ImageGen.ashx...

    the one with "/umbraco/ImageGen" is obviously wrong but i forgot to edit it after pasting it here.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Aug 10, 2011 @ 14:12
    Douglas Robar
    0

    The problem is that the '&' character is a special character in XSLT so you need to escape it to &amp;

    Try this...

    <imgsrc="/ImageGen.ashx?image={current()/outputPictures[position()=1]/DAMP[@fullMedia]/mediaItem/Image/umbracoFile}&amp;width=125"width="125"height="70"/>

    cheers,
    doug. 

  • Frederik T 234 posts 345 karma points
    Aug 10, 2011 @ 16:29
    Frederik T
    0

    Awesome, it works! Thank you very much :) I did see the "&amp" while searching for a solution but i didnt know exactly what they did, so thank again as this will most likely save me from some headaches in the future.

Please Sign in or register to post replies

Write your reply to:

Draft