PDA

Click to See Complete Forum and Search --> : dynimicaly showing thumbnails


asadsiddiqui
Apr 14th, 2005, 03:20 AM
hello, i'm working on greeting card website i want to show the greeting cards thumbnails dynmically,i uploaded the origional images of cards now i want to show them as a thumbnail on my page i have diffrent category of cards for example a category like (Friendship cards) there are 10 cards on this category so when user click on this link next page must show the thumbnails of the orgional cards i have created the loging but it only shows 1 thumbnail on the page so pls tell me how can i handle it, thanks.
following in my code.


<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ import Namespace= "System.IO" %>
<%@ Import Namespace= "System.Drawing.imaging" %>
<script language="VB" runat="server">

Sub page_Load(Sender as object, e as EventArgs)

Const d as string="im/"

Dim s as string,html as string
Dim fullsizeimg as system.Drawing.Image
Dim dummyCallBack as System.Drawing.Image.GetThumbnailImageAbort
dummyCallBack=New system.drawing.image.GetThumbnailimageabort(AddressOf ThumbnailCallback)
Dim thumbnailimg as System.Drawing.Image
for each s in Directory.GetFiles(server.Mappath(d),"*.gif")

fullsizeimg=System.Drawing.Image.FromFile(s)
thumbnailimg=fullsizeimg.GetthumbnailImage(100,100,dummyCallBack,IntPtr.Zero)
thumbnailimg.Save(Response.OutputStream, ImageFormat.gif)
Next (s)

End sub

Function ThumbnailCallback() as Boolean
return False
end function
</script>

dj4uk
Apr 14th, 2005, 03:32 AM
You are streaming an image to the browser which can only display one file at a time.

If you want a page full of thumbnails you need to implement a DataGrid or repeater of images.

e.g.

<asp:Repeater id="rptImages" runat="server">
<ItemTemplate>
<img src="createthumbnail.aspx?file=<%# DataBinder.Eval(Container.DataItem, "FileName") %>" />
</ItemTemplate>
</asp:Repeater>


The createthumbnail.aspx page is passed a querystring of the file that needs to be made a thumbnail (using similar code to you posted).

All you need to do is create a list of files that are needed on the page and databind it to the repeater.

HTH - give me a shout if I have misunderstood what you are trying to do.

DJ