LSGallery - Online Image Gallery

by Lasse Soelberg 23. April 2008 21:00

During Easter I was on a study trip to San Francisco (Fantastic trip Laughing). I took a bunch of pictures there (510 to be exact) and I wanted an easy solution for publishing them online, since some be interesting for the other students that participated in the trip.

I decided on some features that the gallery should have. It should be made in ASP.NET and all I would have to do would be to upload the pictures to my domain with FTP, and then the gallery should take care of the rest. So the albums in the gallery should mimic the folder structure on the server, and when a folder is chosen, it should show the images as clickable thumbnails.

I did a search for this kind of gallery, and it came up empty. At least for solutions where I didn't have to pay anything. But hey, I ain't studying Computer Science for nothing, so I decided to make my own.

The Web Page

The web page has a TreeView control on the left that is used to display the menu. And then it uses a GridView control to show the thumbnails for the selected album. It has a TextBox control on the top that is used for debugging purposes. The following screenshots shows the UI of the gallery.

 

Some Code

I made a class called Library, where I do all the work with the images. This is where I get the list of folders, get the list of images in the folders and make thumbnails of the images. I will just show a single method from that class.

The method that gets the folders uses recursion to easily figure out the folder structure. It builds a TreeNode representation of the folders, for use in a TreeView control on the UI. The following code snippet shows the implementation of the method.

 

The gallery can be seen in action at http://www.soelsoft.dk/gallery/default.aspx.

Tags:

ASP.NET | LSGallery

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen