Tuesday, March 17, 2009

Adding a gallery to your web site

One of the great new features in Gallery Server Pro 2.2 is that all the functionality is contained within a single ASP.NET user control. This makes it easy to integrate into your current ASP.NET application. But did you know you can add a gallery to any web site regardless of the technology? I'll tell you how, but first let me show you how easy it is to add a gallery to your ASP.NET app.

Integrating into an existing ASP.NET application

There are three basic steps:

  1. Copy the Gallery Server Pro files into your web site. Most of them can be placed in a directory of your choosing. A few, such as the SQLite database, .resx resource file, and the compiled dll's, go into pre-defined ASP.NET directories, such as App_Data, App_GlobalResources, and bin.
  2. Configure web.config to define a few settings required by Gallery Server Pro and add one line of code to the Application_Start event in global.asax.
  3. Choose one of your web pages to host the gallery. For example, you might create a new .aspx page that implements your current master page. Add the following to the top of the page:

<%@ Register TagPrefix="gsp" Namespace="GalleryServerPro.Web" Assembly="GalleryServerPro.Web" %>

At the location in the page where you want the gallery to appear, add:

<gsp:Gallery ID="gallery1" runat="server" />

That's it! Fire up the page and you will notice Gallery Server Pro appears in the location you defined. All the functionality that exists, such as logging on, searching, and the task and admin pages, are at your fingertips. One user control that rules it all...

Your app can be written in VB.NET, C#, or any other .NET supported language. You can integrate with your existing membership database or Active Directory users. The world is your oyster.

Integrate into non-ASP.NET web sites

Your gallery is not limited to only ASP.NET web sites. No matter what technology your web site uses, whether it is a set of static .html pages or a dynamic PHP or java site, you can add a Gallery Server Pro gallery. All it takes is a little sleight of hand. The trick is to install Gallery Server Pro as an ASP.NET application on an internet-accessible server that satisfies the technology requirements (primarily that it can run ASP.NET). It could be the same server hosting your web site or another one hosted by a different company. Just get it installed somewhere. Then, in one of the pages of your existing site, add an <iframe> tag to point to the gallery like this:

<iframe id="gs" src="http://www.site.com/gallery/" frameborder="0" style="width:100%;height:100%;border:none;" />

Replace "http://www.site.com/gallery/" with the correct URL.

The host page will load the gallery into the iframe element. To your users, it appears integrated with the rest of the web site. For example, below is a screenshot where Gallery Server Pro is integrated into a Classic ASP web site.


Want to see it in action? Check out the Fort Atkinson Area Chamber of Commerce photo gallery. Notice the web site is a Classic ASP site and the gallery is contained within an <iframe> tag. Two very different technologies, but they seamlessly work together.

There are full step-by-step instructions for both of these techniques, along with additional tips and tricks, in the Admin Guide. Have fun!

No comments: