Click here to Skip to main content
6,630,586 members and growing! (17,283 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Intermediate

Image Galleries using ASP.NET

By (Steven Hicks)n+1

How to do Image Galleries using ASP.NET
Windows, .NET 1.0, .NET 1.1, ASP.NET, Visual Studio, Dev
Posted:29 Apr 2003
Views:127,735
Bookmarked:44 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
30 votes for this article.
Popularity: 2.38 Rating: 1.61 out of 5
22 votes, 73.3%
1
4 votes, 13.3%
2
3 votes, 10.0%
3

4
1 vote, 3.3%
5

Introduction

This article presents an effective and organized way to display mass amounts of images on websites.

This article assumes:

  • You have experience with ASP.NET

Usage

Many times, with large membership based websites, images are collected and the pages are slow to load or poorly organized. This creates frustration for the users and for the webmaster trying to maintain it. Using thumbnails for selection provides the users with a preview of the image that they may choose to view. Due to the small size of thumbnails, it is quicker to load, than to have all the images full size, to load at once.

Design

The design of the Image Gallery is intuitive. It displays the picture above the selection, and centers it. The design of the Image Gallery is borrowed from Windows XP's "My Pictures" filmstrip view.

Data Storage

The data, image name, category, year, etc., are all stored within an XML file. This prevents the code from searching the directories every time it is accessed. The first table of the XML file is the table that holds all the section/category information. With this Image Gallery, all images are stored in: Images/section_name/type_year/images/. This folder structure organizes all the images into easily manageable sections.

The Code

The code is divided into three major parts: the section selection page, image submission, and display of the images.

Image Submission

The image submission page contains a different form type. Because it is accepting file data, it should be set to multipart/form-data. In addition, the control that allows the user to select files is the input type of file. All of this is shown in the included example file, SubmitImage.aspx. When the user submits the image, a post back is called to the server. The post back calls the proper function and streams the file to the server, which then creates a scaled thumbnail also. If a new section is to be created, the function creates the folder and appends the XML file with the new folder information.

Section Menu

The Image Section menu is generated from the first table of the XML file. This parses the section data out into a DataTable, which is bound to a DataGrid.

Image Gallery

The Image Gallery accepts query strings, which tell it what table the data is located. This sets the main image as an asp:Image, and creates a Panel, generated by a MetaBuilders control. This also gives members with administrative roles, the ability to remove images.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

(Steven Hicks)n+1


Member
A VC++ programmer for 4 years. He also has experence in Basic, C#, ASP.net, HTML, and javascript. Also the webmaster of 404Browser.com and Ltpb.8m.com. He also likes refering to himself in the third person perspective.
Occupation: Web Developer
Location: United States United States

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 22 of 22 (Total in Forum: 22) (Refresh)FirstPrevNext
GeneralMy vote of 1 Pinmemberanilozay5:15 11 Dec '08  
GeneralDatagrid thumbnail images Pinmemberskyair16:35 29 Jun '08  
GeneralGood effort, but don't download it PinmemberJCollum11:22 28 Mar '05  
GeneralI got it to work. Pinmembersheppe12:45 7 Aug '04  
GeneralYou dork! Pinmembershadmoss11:54 30 Mar '04  
GeneralRe: You dork! Pinmember(Steven Hicks)n+112:07 30 Mar '04  
GeneralRe: You dork! Pinsuss[echo]22:28 28 Sep '04  
GeneralRe: You dork! PinmemberChristian Graus12:21 30 Mar '04  
GeneralDon't submit sh*t like this Pinmemberanilvny5:15 1 Oct '03  
GeneralRe: Don't submit sh*t like this Pinmember(Steven Hicks)n+114:09 1 Oct '03  
GeneralRe: Don't submit sh*t like this Pinmemberdbld20:02 4 Jan '04  
GeneralRe: Don't submit sh*t like this Pinmember(Steven Hicks)n+13:40 5 Jan '04  
GeneralRe: Don't submit sh*t like this Pinmemberdbld3:57 5 Jan '04  
General; PinsussAnonymous11:31 16 Sep '03  
Generalscript execution error Pinmembertyounsi2:48 20 May '03  
GeneralRe: script execution error PinmemberAndy Smith14:12 6 Jun '03  
GeneralMissing Things PinmemberMikeS7:17 1 May '03  
GeneralRe: Missing Things Pinmember(Steven Hicks)n+110:11 3 May '03  
GeneralRe: Missing Things PinmemberMikeS11:36 4 May '03  
GeneralRe: Missing Things Pinmember(Steven Hicks)n+115:07 4 May '03  
GeneralScreenshot... PinmemberCarl Mercier6:04 1 May '03  
GeneralYeah Thats right where are the screenshot! PinsussAnonymous18:42 6 May '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 29 Apr 2003
Editor: Nishant Sivakumar
Copyright 2003 by (Steven Hicks)n+1
Everything else Copyright © CodeProject, 1999-2009
Web17 | Advertise on the Code Project