What is the easisert was to convert an sql image field to a picture. Ive tried creating and image objcet to hold this data but no sucess anyone tried this ?
Printable View
What is the easisert was to convert an sql image field to a picture. Ive tried creating and image objcet to hold this data but no sucess anyone tried this ?
Can you get the sql image field into a byte array ?
Below is how I deal with uploaded files when I need to get them into an Image. Convert the byte array to a MemoryStream and read it into an Image object.
John
------------------------------------------------------
// get uploaded file into byte array
Byte[] FileByteArray = new Byte[UpFile.ContentLength];
Stream StreamObject = UpFile.InputStream;
StreamObject.Read(FileByteArray,0,UpFile.ContentLength);
//create MemStream of uploaded file
MemoryStream m = new MemoryStream((byte[])FileByteArray);
// set to zero so whole array is read in
m.Position = 0;
// read into Image object
Image objImage = Image.FromStream(m);
// work with image here
// clean up
objImage.Dispose();
objImage = null;
m = null;
Ill have to give that a try.