How can i browse picture as thumbnailImage

  • Thread starter Thread starter lemonvital
  • Start date Start date
L

lemonvital

Hi
I have trouble with me. There are many pictures in Database,i want a
function to browse them as thumbnailimage.The function just like acdsee.how
can i do that? please help me. Thank you in advance.
 
1 way of doing this would be to save thumbnails in your db 2, loading only
the tumbnails and an id will take less time, when the user clicks the thumb
you can display the big thing. code below would create a thumb from a
blobstream, yust set the width and the height.

Dim bmp As Bitmap = New Bitmap(intWidth, intHeight)
Dim gra As Graphics
gra = Graphics.FromImage(bmp)
imgFotoGroot = imgFotoGroot.FromStream(fsBLOBFile1)
gra.DrawImage(imgFotoGroot, 0, 0, intWidth, intHeight)
gra.Dispose()
imgFotoThumb = bmp

hope it helps (suggestions are always welcome)

eric
 
* "EricJ said:
1 way of doing this would be to save thumbnails in your db 2, loading only
the tumbnails and an id will take less time, when the user clicks the thumb
you can display the big thing. code below would create a thumb from a
blobstream, yust set the width and the height.

Dim bmp As Bitmap = New Bitmap(intWidth, intHeight)
Dim gra As Graphics
gra = Graphics.FromImage(bmp)
imgFotoGroot = imgFotoGroot.FromStream(fsBLOBFile1)
gra.DrawImage(imgFotoGroot, 0, 0, intWidth, intHeight)
gra.Dispose()
imgFotoThumb = bmp

If you want to specify the interpolation mode when resizing, have a look
here:

<http://www.google.de/groups?selm=#[email protected]>
 
Hi Lemonvital,

As additon to Eric, to do it from a database and save in that database..
(And use the memorystream)

\\\
Dim ms As New MemoryStream
Dim arrImage() As Byte
originalImage.Save(ms, ImageFormat.Jpeg)
arrImage = ms.GetBuffer
dsFototabel.Tables(0).Rows(0)("foto") = arrImage
Dim PThumbnail As Image
PThumbnail = showimage.GetThumbnailImage(66, 100, Nothing, New IntPtr)
PThumbnail.Save(ms, ImageFormat.Jpeg)
arrImage = ms.GetBuffer
dsFototabel.Tables(0).Rows(0)("thumb") = arrImage
///

Cor







I hope this helps?

Cor
 
Thank for Cor and Eric.
Now i get picture from db by using memorystream and display in grid as
thumbail.but i do not save thumbails in db before,so i get the big picture
for db in fact.I think eric's suggestion is useful.
 
Back
Top