Need Help with Thumbnail Gallery in Panel

Discussion in 'ASP .Net' started by David Elliott, Oct 18, 2003.

  1. I am creating a control to display GIF/JPEG images for my website. The control
    has a Panel to hold the images.

    I would like to perform the following.
    1) store the original on disk and create a thumbnail on the fly.
    2) thumbnail will be 20% of the original size.
    3) the panel will hold all the images of a specific directory

    Using System.Drawing.Image, I can satisfy number 1 and 2, but how would I
    output the info to the panel?

    Is this the best way to do it or is there an alternative?

    Thanks,
    Dave

    David Elliott, Oct 18, 2003
    #1
    1. Advertising

  2. Hi David,

    AS you've found out the GDI+ stuff is pretty trivial.

    But updating the data may not be. There are a couple of ways to do what you
    need. I have a photoalbum app that basically does what you do and it uses
    both approaches from time to time.

    First and probably best is to gen the pictures once and store them with the
    real images. Give them some sort of prefix and then read that prefix into
    your panel as a regular image link. This is most efficient because you only
    gen the images once when you upload or change them. You either update them
    as changes are made or re-gen the whole batch (in case some other means of
    uploading or installing was used such as FTP).

    If you can't have images sitting around then you can stream them directly
    back one at a time. For your image link do something like:

    <img src="ImageShrinker.aspx?Image=ImageName&Path=xxxx">

    Then create the ImageShrinker page to actually shrink one image at a time
    and return it as needed when the page loads and the img tags cause each to
    load.

    To stream an image just do this:

    Response.ContentType = "image/gif"; (or whatever)
    Bitmap.Save(Response.OutputStream,ImageFormat.Gif); (or whatever)


    Oh if your images are really small (in download size) to start with you can
    maybe even just embed them with an image size. The browser will auto-resize
    without any furhter work, but it will still download the whole image. Main
    issue with that is that you have little control how the image gets resized -
    not a problem if they're all the same size, but otherwise the image gets
    distorted.

    Hope this helps,

    +++ Rick ---

    --

    Rick Strahl
    West Wind Technologies
    http://www.west-wind.com/
    http://www.west-wind.com/wwHelp
    ----------------------------------
    Making waves on the Web


    "David Elliott" <> wrote in message
    news:...
    > I am creating a control to display GIF/JPEG images for my website. The

    control
    > has a Panel to hold the images.
    >
    > I would like to perform the following.
    > 1) store the original on disk and create a thumbnail on the fly.
    > 2) thumbnail will be 20% of the original size.
    > 3) the panel will hold all the images of a specific directory
    >
    > Using System.Drawing.Image, I can satisfy number 1 and 2, but how would I
    > output the info to the panel?
    >
    > Is this the best way to do it or is there an alternative?
    >
    > Thanks,
    > Dave
    >
    >
    >
    Rick Strahl [MVP], Oct 18, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xah Lee
    Replies:
    1
    Views:
    446
    Xah Lee
    Apr 19, 2006
  2. Max Quordlepleen

    Thumbnail gallery without tables?

    Max Quordlepleen, Feb 23, 2004, in forum: HTML
    Replies:
    54
    Views:
    1,608
  3. Ed
    Replies:
    5
    Views:
    3,524
    Andy Dingley
    Jan 22, 2005
  4. Xah Lee
    Replies:
    1
    Views:
    303
    Xah Lee
    Apr 19, 2006
  5. mc

    Gallery admin thumbnail control

    mc, Nov 22, 2006, in forum: ASP .Net Building Controls
    Replies:
    5
    Views:
    95
    Walter Wang [MSFT]
    Nov 24, 2006
Loading...

Share This Page