When we want to read and create thumbnail from a database image field, read it and store it into a memory stream object and look into the following code. I am discussing only the key area of this functionality.
The ShowAlbumImage() is a function to return image field of the database as stream.
Then converting the stream obj into image, creating thumbnail using GetThumbnailimage function. Again it is saving to memory stream and can display using context.response.binarywrite()...
Do include required namespaces...
And the Orkut stuff is achieved of transforming an image into a thumbnail...
Stream strm = ShowAlbumImage(picid);
System.Drawing.Image thumbnail = new System.Drawing.Bitmap(strm);
System.Drawing.Image img = thumbnail.GetThumbnailImage(100, 100, null, IntPtr.Zero);
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
The ShowAlbumImage() is a function to return image field of the database as stream.
Then converting the stream obj into image, creating thumbnail using GetThumbnailimage function. Again it is saving to memory stream and can display using context.response.binarywrite()...
Do include required namespaces...
And the Orkut stuff is achieved of transforming an image into a thumbnail...
إرسال تعليق