Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 16:56
    Anthony Candaele
    0

    using ImageGen in Razor script

    Hi,

    I never used ImageGen in a Razor script.

    I wrote this code:

    dynamic file Model.eventImage.mediaItem.EventImage
              
              <img src="[email protected]&amp;width=200px" class="eventimage" />

    but obviously this doesn't work

    Thanks for your help,

    Anthony

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Dec 22, 2011 @ 17:01
    Sebastiaan Janssen
    0

    Almost there, make it "/imageGen.ashx" instead and it should work just fine! 

    Make sure that @file.umbracoFile returns the filename though (and that imageGen.ashx is in the root folder of your site).

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Dec 22, 2011 @ 17:40
    Sebastiaan Janssen
    2

    Just noticed, you forgot the image parameter, so to make it work, try:

    <img src="/[email protected]&amp;width=200px" class="eventimage" />
    
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 22, 2011 @ 18:07
    Jan Skovgaard
    2

    ...And it should not be neccesary to add the "px" to the width :)

    /Jan

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 22, 2011 @ 18:28
    Anthony Candaele
    1

    @Sebastiaan, thanks for the help. Razor is a very intuitive syntax, I just wrote some code that seemed logical to me and I was almost there. This is what strikes me about Razor, it feels so natural to write. The image parameter I forgot was just some slopiness on my side. In the meantime I got my script up and running.

    @Jan, thanks for your suggestion

    greetings,

    Anthony

Please Sign in or register to post replies

Write your reply to:

Draft