Fill Image from response.GetStream

cvanlith

New Member
Licensed User
Is it possible to fill an image from response.GetStream without writing it out to a file first?

Thanks in advance
Chris
 

cvanlith

New Member
Licensed User
Thanks.

So I tried writing it out. Unfortunately when I try to write out a new version of the image it does not allow me that as the file is locked. The lock is caused by Image1.Image = "MapImage.gif".

So the first time it works, the second time FileOpen fails because of the lock. I tried pointing Image1 to another image and FileCopy, but the lock remains.

Any thoughts?
Chris
 

Erel

Administrator
Staff member
Licensed User
I've attached an example which uses a Bitmap object (from the ImageLib library) to load an image from a temporary file, assign it to an Image control and delete the file.
Two 'tricks' are used:
By calling Image1.Image = Image1.Image we are creating an internal copy of the image.
By disposing the bitmap object we are releasing the locked file.
 

Attachments

Top