GeneratedImage - squashed image RRS feed

  • Question

  • User706013099 posted

     I am using the GeneratedImage.dll with a custom ImageHandler to display and manipulate uploaded images. Mostly this works fine. But in a minority of cases, the image is initially displayed squashed to a size of around 100px wide by 30px high - irrespective of the size of the image. Curious thing is if I set a breakpoint on the final Return New ImageInfo(x) in the handler, and then continue (F5), the image is always displayed correctly (at least so far!). Which suggests a timing issue. But I can't figure out which event (if any) I need to wait on before returning from the handler. Tricky one to track down so any suggestions welcome.


    Sunday, July 26, 2009 10:21 AM

All replies

  • User-1055694378 posted

    Couple of questions:

    1. Are you returning transparent PNGs in IE6 with a PNG hack? I am asking because I had a similar issue with that.

    2. I am assuming you use your handler as a source of the <img /> tag, if so does image tag gets dimentions specified?

    3. Are you passing anything is the request to your handler (e.g. src="myhandler.ashx?param1=val1&param2=val2...")?

    4. Are dimentions of the images you render always/often different?

    5. Add a little bit more on how this solution is used so it is easier to determine the issue. 

    Tuesday, August 4, 2009 11:58 PM
  • User706013099 posted

    1. No.

    2. As I indicated, I am using the new GeneratedImage control - with ImageHandlerUrl property set to my image handler (which inherits from Microsoft.Web.ImageHandler). But yes, this effectively means that my handler is the generated img source. And I am not setting dimensions - the handler simply returns an ImageInfo object based on the modified image (System.Drawing.Image).

    3. GeneratedImage takes any parameters. In this case, I am passing a transform action parameter (crop, desaturate, resize, etc) plus other parameters according to action (x,y, etc).

    4. Yes.

    5. Just an image upload feature in a larger application. Clicking on an 'upload' link opens a popup window which has a FileUpload control and the GeneratedImage plus a few image buttons for crop, resize, desaturate, etc. The GeneratedImage is obviously redisplayed (within an UpdatePanel) after each transform.

    As I indiacted in my original post, I suspected that it is a timing issue and I seem to have proved this by adding a 0.1 sec delay in the handler just before it returns the ImageInfo object. But this is clearly a bit crude and I would much prefer to wait on the relevant event - if I knew what it was!




    Wednesday, August 5, 2009 2:17 AM