471,624 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

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(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);

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

Its urgent ..

Thanks and regards..
Sham
Sep 17 '08 #1
2 1818
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
Sep 17 '08 #2
example:

byte[] buffer;
using(MemoryStream ms = new MemoryStream()) {
bit.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
buffer = ms.ToArray();
}
....
SqlCommand cmd = new SqlCommand();
....init
cmd.Parameters.Add(new SqlParameter("blob", Buffer))
....
cmd.ExecuteNonQuery()

where your TSQL uses @blob
Sep 17 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dave | last post: by
3 posts views Thread by Veetold | last post: by
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.