Mat DeLong

January 24, 2013

DataSnap Photo Album Server & Admin Client

Filed under: DataSnap, Delphi, RAD Studio, XE2 — Tags: , , , , , , — mathewdelong @ 7:00 PM

A family member wanted an easy solution for hosting lists of photos locally on their PC which others could see in their web browser if they knew the URL. Requirements were simply that no photos could be stored in any cloud service, the page should have a list of thumbnails which can be viewed all at once and individually zoomed in on, and it should be easy to use and update.

After considering the steps required to install and configure a proper web server on his machine (remotely, from another continent) including server-side scripting plugins, etc… I decided DataSnap was the right tool for the job… no need to use a sledgehammer on a tiny nail.

I got to work, and after an afternoon programming session this was the result:

The server form in action.

The server form in action.

Login panel of client

Login panel of client

Album management from client

Album management from client

The server application is a DataSnap server which handles HTTP requests from a web browser, specifically this URL: http://HOST:8141/ds/rest/TAWMethods/Albums. It also allows for TCP connections, which the client application uses for creating and updating albums. Exposed server methods allow for remote invocation of the required administrative functionalities. (Such as adding an image or deleting one.) The server also allows for setting of an administrative password (authentication manager,) so that not just anyone with your IP and a copy of the client application can modify your album website.

The client application allows for viewing existing albums (including each individual image thumbnail) and adding new albums or photos, adding descriptions to existing photos, or removing photos/albums. It connects to the server using a TCP connection and uses a generated proxy for remotely invoking the server methods.

Here is what the web page looks like in the browser… it is pretty basic. When you click a thumbnail it uses the free ‘Highslide’ JavasSript library to pop up a large version of the image:

Main page, listing all the albums

Main page, listing all the albums

AlbumsPage2

Example album page

AlbumsPage3

Another example album page

This is a pretty basic application, but I think it shows DataSnap’s beautiful simplicity. I built this quickly and to deploy it to my family member’s PC I just gave them the ZIP file and told them to unzip it anywhere they wanted. If you are interested in the source code leave a comment. If I get enough interest, I might throw together another blog post including the source and some more detail.

Download Here

UPDATE:
Softpedia randomly found this application and featured it on their site!: http://www.softpedia.com/get/Multimedia/Graphic/Graphic-Others/Album-Website.shtml

5 Comments

  1. Hi Mat, THanks for this post. I am a self educated Delphi user for my vet clinic. I have recently started using DataSnap to allow my cat boarding facility to connect to my vet clinic database. It has been an interesting learning curve, and I would appreciate it if you could either send me the code for the program, or publish it on line. I dont intend to use it, but to see how you have used some of the datasnap object. I assume that you are using XE3; if not that is OK because I have been using D2010, but mI want to start getting my head around XE3. ThanksRod Grahamvillagevet@hotmail.com

    Date: Wed, 23 Jan 2013 20:03:51 +0000 To: villagevet@hotmail.com

    Comment by Rod Graham — January 24, 2013 @ 7:01 PM

  2. I would appreciate it if you could publish it online.

    Comment by JonyOang — January 25, 2013 @ 9:53 AM

  3. Nice example. Thank you. I am very much interested in source code.

    Comment by Erwin Mouthaan — January 26, 2013 @ 3:42 PM

  4. Glad you like this example. I will post another entry explaining some of the parts of it. For now, you can find the source code here: http://sourceforge.net/projects/albumwebsite/

    Comment by mathewdelong — January 27, 2013 @ 11:21 AM

    • The source code is there, just not attached as a download. If you click the “code” tab and then the “trunk” folder, it should all be there. I’ll post a zip copy of the source on my next blog post.

      Comment by mathewdelong — January 30, 2013 @ 2:47 AM


RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Create a free website or blog at WordPress.com.

%d bloggers like this: