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.