Results 1 to 2 of 2

Thread: dynimicaly showing thumbnails

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    9

    dynimicaly showing thumbnails

    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>

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: dynimicaly showing thumbnails

    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.
    Code:
    <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

    If I have been helpful please rate my post. If I haven't tell me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width