Monday, February 21, 2011

Gallery Server Pro 2.4.6 Released

Less than two months after 2.4.5 was released, I am pleased to announce 2.4.6. There are a bunch of new features along with the normal collection of bug fixes.

The Admin Guide has instructions for upgrading to this version. The short story is that you use the Upgrade Wizard for upgrading from 2.3.*. To upgrade from 2.4.*, simply replace the web files with the latest version.

The philosophy behind this release was to implement the “low-hanging fruit” features that have been frequently requested but didn’t require significant resources. In the coming weeks I will post a roadmap about what is coming down the pipe.

New features

  • Automatic synchronizations
  • Synchronizations can be remotely triggered
  • Synchronization performance increases, especially for large galleries
  • Improved UI feedback during synchronizations
  • Faster search performance
  • ‘Embed code’ allows media objects to be added to other web sites
  • New admin setting: Allow users to download media files but not entire albums
  • Albums always sorted at the beginning of any thumbnail list
  • Allow keeping underlying file or directory when deleting objects
  • More flexibility when choosing a thumbnail image for an album
  • More flexibility for generating captions for new media objects
  • More metadata extracted from files, including IPTC and GPS properties
  • GPS coordinates now link to Bing or Google Maps
  • Admin can specify order and visibility of metadata
  • jQuery path setting exposed in admin area
  • Additional application details shown in admin area
  • Improved thread safety
  • Added support for router port forwarding scenarios
  • Upgraded to jQuery 1.5
  • Upgrade to latest version of SharpZipLib

Bug fixes

  • Synchronization estimated time left never changes from “Calculating…”
  • Album thumbnails not always correctly updated after moving media objects
  • Null reference exception when HttpContext.Current.Request.Browser.Browsers is null
  • E-mail notification sometimes stops working
  • Anonymous user can view media object when anonymous browsing is disabled
  • Titles of new objects are empty strings when metadata value contains whitespace
  • Metadata window shows only the first 20 metadata items
  • DivideByZeroException caused by invalid metadata
  • Rating metadata imported when it has never been assigned
  • User loses breadcrumb location when saving change on Gallery Settings page
  • Gallery setting 'Discard the original image when it is added to the gallery' is always unchecked and cannot be enabled
  • Now able to extract ZIP archives created by Hotmail

Synchronization improvements

Several changes to the synchronization area improves user feedback, performance, and gives administrators additional management options.

Performance improvements: GSP has always been able to handle hundreds of thousands of files, but around the 100,000 object mark or so the synchronization process would get noticeably slower. Database profiling revealed that significant gains could be made by adjusting one of the stored procedures and adding an index and a few statistics. There were also some changes to the API that reduced unnecessary overhead. For example, there was no need to load the metadata associated with existing media objects at the beginning of a synchronization. By modifying the code to allow for a “lightweight” version of each media object, they load much faster and put reduced pressure on the memory of the server.

The database tuning applies only to SQL Server. If you are using SQLite and are experiencing performance issues, then you should migrate to SQL Server. The Admin Guide has instructions.

Improved UI feedback during synchronization: The first step in any synchronization is to load the existing media objects into memory. When the gallery contains hundreds of thousands of items, this can take a while. Prior versions of GSP did not update the progress window during this phase, leading users to wonder what was happening or thinking the application locked up. Worse, a bug compounded the problem by sometimes incorrectly showing “Calculating…” for the entire duration of the synchronization instead of giving meaningful updates.

The bug has been fixed. And now the progress window informs the user during the initial phase where items are loaded into memory, as seen here:


Auto-sync and remotely triggered syncs: You can now schedule a synchronization to automatically occur at periodic intervals. This allows the gallery to automatically stay up to date with files and directories in the media objects directory on the server. This feature can be managed on the Albums page in the site admin area:


The scheduling logic depends on the application being kept alive by periodic HTTP requests. If no one browses the gallery, the code that checks if a sync is required never runs. As you might expect, the sync interval is only approximate, but should be reasonably accurate in any gallery that has at least a few hits per hour.

One can also remotely trigger a sync through two new web services. These web services require a password – you choose that password in the admin page shown above.

How you invoke the web service depends on how it is configured in web.config. By default, it is set to accept HTTP POST.

Faster search performance

Search performance was improved by the addition of an index on the gs_MediaObject table. If you have hundreds of thousands of objects and are still experiencing slow searches, you can further improve performance by modifying the search stored procedure to ignore metadata in searches. It is named gs_SearchGallery. Use SQL Management Studio or a similar tool to delete or comment out the section that queries the gs_MediaObjectMetadata table.

This affected SQL Server only. Again, if you are experiencing performance issues with SQLite, it is time to migrate to SQL Server.

‘Embed code’ allows media objects to be added to other web sites

You can now get embed code for any media object by clicking one of the buttons above the media object:


This embed code lets you add media objects to other sites while keeping the original files on your own server.

New admin setting: Allow users to download media files but not entire albums

One of the cool features in GSP is that users can quickly download a bunch of media objects in a ZIP archive. However, there was a potential for a user to overwhelm a server by requesting that a top level album be packaged into a ZIP file. For example, downloading the root album in a gallery with 100,000 objects causes the server to try to add 100,000 files to a ZIP archive and then transmit it to the user. Not cool.

Starting in 2.4.6, an administrator can specify that only media objects in the current album can be added to a ZIP archive:


Albums always sorted at the beginning of any thumbnail list

Previous versions of GSP added new items at the end of each album, whether they were albums or media objects. This sometimes caused albums and media objects to be mixed together in a seemingly random fashion, making it hard to quickly find an item. In 2.4.6, albums are always shown at the beginning, and media objects are always shown at the end. This cannot be overridden, even with the rearrange function.

This is similar to how Windows sorts directories and files in Windows Explorer.

Allow keeping underlying file or directory when deleting objects

Starting in 2.4.6, one can delete an album or media object from the gallery without deleting the underlying directory or file. A new option appears on the Delete objects page:


Since the directory and media files aren’t deleted, they will re-appear if you synchronize the parent album. If you want to permanently prevent items from appearing in the gallery, but you don’t want to delete them from the server’s hard drive, use one of these tricks:

  • Mark the file or directory as hidden with a file utility such as Windows Explorer
  • Edit the NTFS permissions on the IIS application pool identity so that it does not have access to the file or directory.

More flexibility when choosing a thumbnail image for an album

You can now select from albums in addition to media objects when choosing a thumbnail image for an album. This lets you “bubble up” an image from a nested album:


More flexibility for generating captions for new media objects

Before 2.4.6, if GSP discovered a title embedded in the metadata of an image, it used that for the media object’s caption. If not found, it defaulted to the file name. That is still the default behavior in 2.4.6, but you can now change it if you want. A setting on the Metadata page (which is also new in 2.4.6) defines the template to use when assigning captions for newly added media objects:


As you can see, the default value is {Title}, but dozens of replacement tokens are supported. A complete list is found further down on the Metadata page. Here is a partial list:


For example, say you want the title and file size assigned as the default caption. Specify a template like this:


Then, when you add a media file, the caption is automatically assigned:


You can mix hard coded text as well as HTML in the template. Note: You must have the HTML editing option enabled if you want to use HTML in the template. (Do this on the User settings page.)

More metadata extracted from files, including IPTC and GPS properties

Several third party programs allow users to embed metadata in image files. This version has improved support for extracting IPTC metadata as well as GPS data.

Note that this functionality requires .NET 3.0 or higher and that the application be running in full trust.

GPS coordinates now link to Bing or Google Maps

When an image has GPS data, a link to Bing Maps is automatically created:


If you prefer to use Google Maps, no problem. Just update the template on the Metadata page. The popup help icon contains a pre-tested template that works with Google Maps.


Admin can specify order and visibility of metadata

Control which metadata items are visible and in what order in a new admin setting on the Metadata page:


Upgrade to jQuery 1.5 /jQuery path setting exposed in admin area

Now that jQuery 1.5 is out, GSP was updated to point to the latest version. And the setting was exposed in the Site Settings – General page to make it easier to change:


There are two things to note about the jQuery URL:

  1. It starts with “//”, not “http://”. This is intentional and helps improve caching performance while still supporting SSL scenarios. A good discussion can be found here.
  2. It doesn’t actually reference version 1.5. Instead, the “1” you see just before jquery.min.js indicates that any 1.* version is acceptable. By doing this, GSP will automatically stay up to date with the current version of jQuery – at least until version 2 is released. If you don’t like the uncertainty this brings to your gallery (because an update could break things), then update the path to specify a particular version.

Note also the admin exposes a setting for jQuery UI. jQuery UI was added for 2.4.6 and is currently used on the Metadata page to provide the cool drag and drop functionality. I anticipate expanding its usage in the future.

Additional application details shown in admin area

A few additional pieces of information are now shown on the Site Settings – General page:


Improved thread safety

Some refactoring was done to ensure that objects are updated and iterated in a thread-safe manner.

Added support for router port forwarding scenarios

Support was added for users who configure their router to forward requests on a particular port to an internal location that may be on a different port. For example, you might expose your gallery to the world at, but in your router configuration you send this traffic to port 80 of a local web server.

GSP now detects this situation and behaves appropriately. This required two changes:

  1. The external-facing address was explicitly assigned to all instances of the ComponentArt Callback control.
  2. URLs generated by the gallery (such as a welcome email) now reflect the external address, not the internal one.

Upgrade to latest version of SharpZipLib

A user reported that GSP could not unzip files created by Hotmail. This is actually handled by a third party library called SharpZipLib. I upgraded to the latest version with the hope that it would fix the problem, but it did not. However, with a little extra work, I coded a bug fix that seems to do the trick. This tweaked version of SharpZipLib is included in 2.4.6. I reported the potential bug to SharpZipLib and hopefully they’ll incorporate the bug fix in the core product.