Scott Cate Weblog 

scott.cate@myKB.com
http://scottcate.myKB.com



Scott Cate KB > ASP.NET Code Samples - Findings > Community Involvement Start Over
Search the Knowledge Base
 
Start Search in the Following Category
Date Modified
Saturday, January 31, 2004
New Photo Album Application

I just treated myself to a new digital camera. I've been wanting this camera since I saw it over a year ago. A friend of mine took my picture with this credit card sized camera, and I was in love with it ever since. My goal was to have a camera I could carry around, and not look like a tourist, so the number one objective was size. The Casio Exilim 3.2 S2 is perfect for my needs. It's external memory uses Secure Digital cards, which are also in use on my pocket PC phone, and my laptop, the second biggest selling point.

So now I have all these pictures how am I going to share them? Last weekend I went hiking with a small group of 10 people, and of course I'm picture snap happy. So I decided to build a little app that would just work for me on my site. All I want to do is FTP JPG files up to my web server, and have this little application do the rest.

<!-- <add key="PhotoPath" value="Whatever" /> --><!-- Default = Current Dir -->
<add key="LowResImageWidth" value="600" /> <!-- Default = 600 -->
<add key="ImagesPerRow" value="4" /><!-- Default = 4 -->
<add key="ThumbnailImageWidth" value="125" /><!-- Default = 125 -->

In the web.config I set the "PhotoPath", "ThumbnailImageWidth", "ImagesPerRow", and "LowResImageWidth" properties. After that, all you'll have to do, to throw the DLL in your BIN directory, and all your code will be e-mailed to me. HaHa just kidding, seeing if you're paying attention. All the appSettings have defaults set int eh code, so they are not necessary, unless you want to change the values.

The "RootImageDirectory" property should be set to the Subdirectory that you plan to place your images in, and this will also be the directory, that you place the following 3 files.

  • Default.aspx (This is just a placeholder for Album.ascx)
  • ShowImage.aspx (This is the Low Res - Resize Code)
  • Album.ascx (This is the repeated user control)

When the Default.aspx page loads, it looks for JPG files. If it finds them, it looks for a Directory named "TN" for Thumbnail. If it finds the Dir, it checks to see if the same filename is found, if it is, it shows the thumbnail, if it isn't, it creates it, and then shows the thumbnail.

Because the application is writing to your directories, you'll need to grant the asp.net worker process account write permissions to the directories.

For those of you, a little more enthusiastic, the entire project code is also available here.

This code is not warranted, has not been tested, and is available for example use only. Please use it at your own risk........ Basically, you can use it, steal it, say it was yours, but just don't delete your hard drive and come blaming me.

 

Article References
Download only the end user files to run a Photo Album Application
Download the full C# source code, and Visual Studio 2003 Project


All rights reserved. All details are the personal opinion of Scott Cate.
All trademarks referenced are the property of their respective owners.
Scott Cate is a lead programmer for www.myKB.com and
owner of The Arizona .NET User Group and an all around nice guy ;)


Knowledge Base Software - myKB.com

 

Cameron Cate Pictures
Cameron Cate Pix

Site Navigation

Home
Knowledge Base
Wiki Discussions
Photo Album

Sites I Own & Run


Easy Search ASP.NET
mykb.com knowledge base software logo
myKB.com
Knowledgebase Software

KBAlertz.com
Arizona .NET user Group
Group Leader

Affiliations


ASP.NET MVP
2004
2005
2006
2007
2008
2009


Blog Sites I Read

Brady Gaster
Rob Howard
G. Andrew  Duthie
Robert McLaws
Alex Lowe

World of Scott.Net

Scott Guthrie
  -  Father of ASP.NET

Scott Watermasyk
  - .Text (Weblog)

Scott Sargent
Scott Mitchell
ScottG.net
Scott Bellware
Scott Forsyth
Scott Hanselman
Scott Cate

Favorite Books


ASP.NET Cookbook


First Looks @ ASP.NET 2.0