Copied to clipboard

Flag this post as spam?

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


  • M4TTHEW 21 posts 61 karma points
    Oct 25, 2010 @ 16:33
    M4TTHEW
    0

    borders on thumbnails?

    can anyone assist me with this? ImageGen works great, using it alongside the Designit Lightbox gallery, fantastic, but i want a border around my thumbnails...any help?

    looked at this:

    braco/imagegen.ashx?image=bigImage.jpg&width=50&height=50&constrain=true&pad=true&bgcolor=white

    but i get an error when i copy/paste that into my "thumbnails.xslt" file. anyone help? TIA ;)

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 25, 2010 @ 16:51
    Douglas Robar
    0

    I assume you're getting the border you want when you put this in your browser or the src="" attribute of an <img> tag, right?

    If you're looking for a border no matter what, you might also want to use the &border=4 parameter on the querystring.

    You didn't say specifically but I suspect it works as above but not when you pasted it into your xslt macro. If so, the issue is with the ampersand characters ('&'). You need to encode those to work in XSLT.

    Just replace all the '&' characters with '&amp;' when you put it in XSLT and it'll work.

    cheers,
    doug.

  • M4TTHEW 21 posts 61 karma points
    Oct 25, 2010 @ 17:13
    M4TTHEW
    0

    thanks Doug! the '&amp;' fixed the xslt errors, but i am still not getting a border, i suspect that it's because i am using the Designit Gallery and that i need to modify that instead of just using stanard ImageGen parameters. for example, in auto-created 'thumbnails.xslt" file, i have this code:

    <xsl:template name="drawImage">
           <xsl:param name="imageid"/>
           <xsl:param name="thumbwidth" />
           <xsl:param name="align" />
           <img>
              <xsl:attribute name="src">
                <xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
                <xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/data [@alias = 'umbracoFile']"/>
                <xsl:text>&amp;width=</xsl:text>
                <xsl:value-of select="$thumbwidth"/>
                <xsl:text>&amp;constrain=true</xsl:text>
              </xsl:attribute>

              <xsl:attribute name="alt">
                  <xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/@nodeName"/>
              </xsl:attribute>

              <xsl:if test="$align != ''">
              <xsl:attribute name="align">
                <xsl:value-of select="$align"/>
              </xsl:attribute>

              </xsl:if>
            </img>
      </xsl:template>

    so i can't just insert ImageGen parameters in there, i need to make a new macro parameter for the desired border and then call it in like the "thumbwidth" is called in the code? i'll keep tinkering with it, thanks for your help on your part of the puzzle.

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 25, 2010 @ 17:24
    Douglas Robar
    0

    Super.

    The first thing to do is get ImageGen to produce the image you want, just from the browser's url line.

    http://localhost/umbraco/imagegen.ashx?image=/media/1234/bigImage.jpg&width=100&border=4&bordercolor=ffffff

    Once you get the output you want you'll know what parameters to use in your XSLT as well.

    If you need to parameterize them in the macro because they might vary (like the thumbwidth, for instance) just handle those as you do the others. If you are happy to hardcode values it would be done something like this:

            <xsl:attribute name="src">
                <xsl:text>/umbraco/ImageGen.ashx?image=</xsl:text>
                <xsl:value-of select="umbraco.library:GetMedia($imageid, 'false')/data [@alias = 'umbracoFile']"/>
                <xsl:text>&amp;width=</xsl:text>
                <xsl:value-of select="$thumbwidth"/>
                <xsl:text>&amp;border=4&amp;bordercolor=ffffff&amp;constrain=true</xsl:text>
              </xsl:attribute>

    cheers,
    doug.

  • M4TTHEW 21 posts 61 karma points
    Oct 25, 2010 @ 22:55
    M4TTHEW
    0

    thanks again for the reply, i really appreciate the help, however, when i put:

    http://172.16.1.14/umbraco/ImageGen.ashx?image=/media/6329/004.jpg&width=100&height=100&border=4&bordercolor=ffffff&constrain=true

    in my browser i get the full size image, not the thumbnail, and not the border or anything :(

    also, when i tried your code above (hardcoded) into the xslt file it made no difference at all on my page :( i suspect i need to look into the way the Designit Gallery/Lightbox is creating the thumbnails independently of ImageGen? here's my source code (from a "View Source" on the rendered page):

    <div id="aside">
            <a class="gallery"><form method="post" action="/products/gallery.aspx" id="aspnetForm">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUENTM4MWRk89Q9oPpYmKCEZimAnMbJVVBbp84=" />
    div>
    
    
    <script src="/scripts/Designit.Gallery/jquery.lightbox-05.pack.js" type="text/javascript">script>
    <script src="/scripts/Designit.Gallery/jquery.lightbox-0.5.js" type="text/javascript">script>
    
            <div id="diGallery">
    
            <a id="ctl00_ctl00_ContentPlaceHolderDefault_ShowGallery_1_repImages_ctl01_hlImage" title="test1" href="/umbraco/ImageGen.ashx?image=/media/6329/004.jpg&width=500&height=500&constrain=true"><img id="ctl00_ctl00_ContentPlaceHolderDefault_ShowGallery_1_repImages_ctl01_img" src="/umbraco/ImageGen.ashx?image=/media/6329/004.jpg&width=100&height=100&constrain=true" alt="test2" style="border-width:0px;" />a>
    
            <a id="ctl00_ctl00_ContentPlaceHolderDefault_ShowGallery_1_repImages_ctl02_hlImage" title="test2" href="/umbraco/ImageGen.ashx?image=/media/6497/003.jpg&width=500&height=500&constrain=true"><img id="ctl00_ctl00_ContentPlaceHolderDefault_ShowGallery_1_repImages_ctl02_img" src="/umbraco/ImageGen.ashx?image=/media/6497/003.jpg&width=100&height=100&constrain=true" alt="test2" style="border-width:0px;" />a>
    
            div>
    
    <script type="text/javascript">
    $(function() {
      $('#diGallery a').lightBox();
    });
    script>
    form>a>
          div>
    

    see that part at the end of the , that must be coming from Designit somewhere i suspect i need to find that and modify/remove it. thanks again for all of your time and assistance Doug! i'll just keep futzing with it, i'll eventually figure it out i suppose.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 25, 2010 @ 23:29
    Jan Skovgaard
    0

    Hi M4TTHEW

    Can't you just set the border with CSS? Or am I missing something?

    /Jan

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Oct 26, 2010 @ 11:54
    Douglas Robar
    0

    Okay, let's take this in stages. The first stage is to get the right output from ImageGen from the browser's URL line. For that, you do NOT want to expand the '&' characters to '&amp;' characters.

    This should work to give you a small thumbnail with a white border (will be hard to see the white border in the browsers because the browser's background is also white... so for this example I changed the border to red for testing... change it back to white when you're satisified with the output).

    http://172.16.1.14/umbraco/ImageGen.ashx?image=/media/6329/004.jpg&width=100&height=100&border=4&bordercolor=ff0000&constrain=true

    That works, right?

    If not, please explain what you do see, and which version of ImageGen you're using (use the imagegen.ash?version)

     

    Assuming you get the image you want from ImageGen on the querystring, it should be a fairly straightforward process to make it work in LightBox or any other display utility, and there are multiple pakages for photo/lightbox/litebox galleries. Just be sure you pick one that is compatible with your version of Umbraco (if you're using 4.5.x then older packages for v3 and v4.0 may not be updated for the new XML schema).

     

    Let us know what you find out.

    cheers,
    doug.

     

     

  • M4TTHEW 21 posts 61 karma points
    Oct 26, 2010 @ 15:17
    M4TTHEW
    0

    thanks again Doug! yes, that link works and i do get the thumbnail with the red border. using Umbraco 4.5.x and using ImageGen 2.0.1 with the updates installed. i'll keep tinkering with it, thanks for all of your help and guidance on this! ;)

  • M4TTHEW 21 posts 61 karma points
    Nov 03, 2010 @ 17:08
    M4TTHEW
    0

    just FYI, i got a solution from the developers of Designit Gallery...in the ShowGallery.ascx file you need to add a <div id="name"></div> to the actual image parameter, like this:

    <div id="diGallery"><asp:HyperLink ID="hlImage" 
    runat="server"><asp:Image ID="img" runat="server" 
    /></asp:HyperLink></div>

    then you can call #diGallery in your .css file and voila! it works! thanks for all the help Doug, learned a lot! ;)

Please Sign in or register to post replies

Write your reply to:

Draft