Last post Aug 05, 2009 02:17 AM by jstranger
Jul 26, 2009 10:21 AM|jstranger|LINK
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.
Aug 04, 2009 11:58 PM|vitaliid|LINK
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¶m2=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.
Aug 05, 2009 02:17 AM|jstranger|LINK
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).
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!