Copied to clipboard

Flag this post as spam?

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


  • Ben Price 15 posts 35 karma points
    Jan 31, 2011 @ 08:48
    Ben Price
    0

    ImageGen Not finding images

    I'm trying to use the following to access my pictures via an additional tab on the standard.master page and template, but the images don't show up, I get the "image not found" graphic.

    <img src=/umbraco/ImageGen.ashx?image=<umbraco:Item field='himg' runat='server'></umbraco:Item> />

    When I try to isolate the issue, I see that after the merger happens, the code is showing as

    img src=/umbraco/ImageGen.ashx?image=1226

    but that's not the image's name, nor does it find it. Any ideas?


  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 31, 2011 @ 08:55
    Jan Skovgaard
    0

    Hi Ben

    That's because you need to get the image using XSLT. What you get returned is the id for the image so this is not an imagegen issue.

    You can fetch the image using XSLT either inline in the template or by creating a XSLT based macro in the developer section. You need to use the GetMedia XSLT extension to do this. You can see some explanation and examples on how to use the extension here: http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia

    /Jan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 31, 2011 @ 08:57
    Kim Andersen
    0

    Hi Ben

    I assume that the himg is a media picker. This returns a media id, so you have to use some inline XSLT if you don't want to use this in a macro. Could you maybe try something this:

    <umbraco:Item runat="server" field="himg" xslt="concat('&lt;img src=&quot;/umbraco/ImageGen.ashx?image=', umbraco.library:GetMedia({0},0)/umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true" />

    /Kim A

  • Ben Price 15 posts 35 karma points
    Jan 31, 2011 @ 09:00
    Ben Price
    0

    So you're saying the whole line should look like this:

     

    <img src=/umbraco/ImageGen.ashx?image=<umbraco:Item field='himg' runat='server' xslt="concat('&lt;img src=&quot;/umbraco/ImageGen.ashx?image=', umbraco.library:GetMedia({0},0)/umbracoFile, '&quot; /&gt;')" xsltDisableEscaping="true" /></umbraco:Item> />

     

    ?  If so, not working, still not finding it.

  • Ben Price 15 posts 35 karma points
    Jan 31, 2011 @ 09:01
    Ben Price
    0

    And yes, himg is a media picker, I apologize for not posting that in the description.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 31, 2011 @ 09:03
    Jan Skovgaard
    0

    Hi Ben

    Take another look at the sample Kim just posted - it does not match the one you posted.

    In his example the imagegen stuff is inside the umbraco:item - in yours you have it both outside and inside.

    /Jan

  • Ben Price 15 posts 35 karma points
    Jan 31, 2011 @ 09:05
    Ben Price
    0

    Awesome.  It's 3am here and I've been staring at this for hours, should've caught that.  Thanks sooo much for your help!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 31, 2011 @ 09:07
    Jan Skovgaard
    0

    Hi Ben

    You're welcome. Happy to hear you got it sorted out. Please don't hesitate to ask if you're stuck another time.

    And please mark this post as solved :-)

    /Jan

  • Ben Price 15 posts 35 karma points
    Jan 31, 2011 @ 09:09
    Ben Price
    0

    Be glad to, where do I do that?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 31, 2011 @ 09:10
    Jan Skovgaard
    0

    There should be a button beneath the posts (But have a look for the button at Kim's post, right :)), which is highlighted in green where it says "mark as solution".

    /Jan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Jan 31, 2011 @ 09:14
    Kim Andersen
    0

    Great to hear that you got it solved Ben. Actually I hadn't tried the code myself, so there could have been a small error somewhere, but I'm glad there wasn't :)

    /Kim A

  • Ben Price 15 posts 35 karma points
    Jan 31, 2011 @ 09:15
    Ben Price
    0

    Got it, thanks again!

Please Sign in or register to post replies

Write your reply to:

Draft