Results 1 to 3 of 3

Thread: converting a sql image field to a picture??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    outerspace
    Posts
    126

    converting a sql image field to a picture??

    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 ?
    "All those who wonder are not lost" -j.r.r tolkien

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    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;

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    outerspace
    Posts
    126
    Ill have to give that a try.
    "All those who wonder are not lost" -j.r.r tolkien

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width