Retrieve Image Full path with its extention

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?U2hhbQ==?=

    #1

    Retrieve Image Full path with its extention

    Hai,

    I am developing application which handles to create thumbnail form a video
    file.
    I am successfully created image and i displayed it into browser by,

    bit.Save(Respon se.OutputStream , System.Drawing. Imaging.ImageFo rmat.Gif);

    Now my situation is, i need to save it into my database(sqlser ver).
    Can anyone tell me how to get that displayed(curre ntly displayed) image file
    - full path with its extention(like .gif).

    Its urgent ..

    Thanks and regards..
    Sham
  • Marc Gravell

    #2
    Re: Retrieve Image Full path with its extention

    Well, if you have created it in-memory, there might not *be* any file,
    except perhaps in the client's cache which you don't have access to.
    You might try use Save to write to a MemoryStream, and then from a
    MemoryStream you can get the raw byte[] (ToArray etc), which should be
    fine for passing as a parameter to a TSQL method, for use in a
    varbinary(max) [or "image" pre-SQL2005] column.

    (assuming the image isn't too big; for very large byte[] you might
    need to "chunk" the work)

    Marc

    Comment

    • Marc Gravell

      #3
      Re: Retrieve Image Full path with its extention

      example:

      byte[] buffer;
      using(MemoryStr eam ms = new MemoryStream()) {
      bit.Save(ms, System.Drawing. Imaging.ImageFo rmat.Gif);
      buffer = ms.ToArray();
      }
      ....
      SqlCommand cmd = new SqlCommand();
      ....init
      cmd.Parameters. Add(new SqlParameter("b lob", Buffer))
      ....
      cmd.ExecuteNonQ uery()

      where your TSQL uses @blob

      Comment

      Working...