Copied to clipboard

Flag this post as spam?

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


  • Frank van Rooijen 7 posts 27 karma points
    Nov 09, 2011 @ 16:48
    Frank van Rooijen
    0

    Exception has been thrown by the target of an invocation.

    Hello,

    I am trying to add an overlayimage on my current image by adding a tag "OverlayImage" in my class defenition.
    In the tag I specyfy the full pathname and filename. The overlay image is a png.
    When accessing the url I get the following error: "Exception has been thrown by the target of an invocation."
    If I remove the overlay tag the image shows as it shoud.

    I am using ImageGen Professional version 2.5.7.27945.

    Is this a bug or did I make a mistake in my configuration.

    Help is appriciated.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 09, 2011 @ 16:52
    Douglas Robar
    0

    Hi, Frank,

    What's the command you're using that gives the error? (the imagegeh.ashx? ..... line as it is sent to the browser)

    And, since you're using classes, what classes do you have defined in the imagegen.config file?

    Thanks!

    cheers,
    doug. 

  • Frank van Rooijen 7 posts 27 karma points
    Nov 10, 2011 @ 08:21
    Frank van Rooijen
    0

    Hi Douglas,

    I am invorking the following url:
    http://localhost/imageGen.ashx?image=/media/16782/dina.png&class=smallBanner

    This is the matching class from the config:
    <Class name="smallBanner" OverridesQueryString="true">
            <Width>50</Width>
            <Constrain>true</Constrain>
            <Compression>100</Compression>
            <ImageBaseDir>http://localhost</ImageBaseDir>;
            <OverlayImage>C:\inetpub\www\image\logo_banner.png</OverlayImage>
    </Class>

    When I remove the OverlayImage tag the picture is rendered. Adding this tag will result in the described error. (Exception has been thrown by the target of an invocation.)

    cheers,
    Frank

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

    Thanks, Frank, that helps a lot.

    There are a couple things going on here all at once. I'll try to explain them all and then make a recommendation of how to move forward.

    1. You're using a remote url in the ImageBaseDir and there is a bug in 2.5.7 that tries to apply that to the OverlayImage as well. As you can imagine, http://localhost/c:\inetpub\www\image\logo_banner.png won't work and that's where the error is coming from. 

    I'm working on a fix to this, along with another issue related to the altImage, which has the same issue. It's a complex fix though so it will take a little time.

    2. You're using a remote url in the ImageBaseDir but its the same as your site's url so it isn't needed. 

    You could omit the ImageBaseDir entirely and the request for /media/16782/dina.png would still work just fine. This would also remove the problem I described in item 1 above.

    3. I'm guessing that the path you specify in the OverlayImage is the same as your site's path on the drive. If so, you don't need to include the path to the root of your site, just the relative path from the site's root (probably \image\logo_banner.png)

     

    So, we've got a bug and some unnecessary complexity that are conspiring to cause these problems. I would suggest you simplify the Class as follows:

    <Class name="smallBanner" OverridesQueryString="true">
            <Width>50</Width>
            <Constrain>true</Constrain>
            <Compression>100</Compression>
            <OverlayImage>\image\logo_banner.png</OverlayImage>
    </Class>

    cheers,
    doug. 

  • Frank van Rooijen 7 posts 27 karma points
    Nov 10, 2011 @ 11:38
    Frank van Rooijen
    0

    Hi Douglas,

    The url of the site is the same as where the image is located. Unfortunatlly the images are not stored on the same machine, they are stored on a NAS. So calling the image without the base url will cause the following error: Requested image path is not allowed. (/media/16782/dina.png). I described this behaviour here.

    I tried to remove the whole path of the overlay image and just use

    <OverlayImage>/images/logo_banner.png</OverlayImage>

    So the real path would translate to http://localhost/image/logo_banner.png. Also this setup will cause the error: Exception has been thrown by the target of an invocation. I also tried to store the overlay image on the same location as the media folder (/media/images/logo_banner.png), but the end result is the same.

    When I copy all the media-files to the website folder, it works as expected. But when I add the ImageBaseDir to this set up. I recieve the same error.

    Would be nice if you could take this kind of set up in consideration in the next release of ImageGen. For now I will just watermark the images with an overlay in css.

    Cheers,
    Frank

Please Sign in or register to post replies

Write your reply to:

Draft