Wednesday, April 7, 2010

New version adds features, support for .NET 4.0, and fixes bugs

The latest version of Gallery Server Pro fixes several bugs, adds a few minor features, and includes support for ASP.NET 4.0. Download it here. The Web Platform Installer version will be released in a week or two. There are no changes to the database schema, so upgrading is as simple as saving a copy of your web.config and galleryserverpro.config files, replacing the web files with the new ones (but don’t overwrite your SQLite database file galleryserverpro_data.sqlite), and then navigating to default.aspx?g=upgrade in your web browser. Detailed upgrade and installation instructions are in the Admin Guide.

Besides fixing over a dozen bugs, this version adds the following features. Below I dig into these in more detail.

  • Includes support for running under .NET 4.0
  • Added support for web archive files (.mht)
  • Easier integration into other web applications
  • Backup file now compressed in ZIP archive to enable faster download and uploads
  • Files are guaranteed to be added in alphabetical order during a synchronization
  • Automatically clear deleted users from album owner field
  • Improved date parsing of image metadata

Support for ASP.NET 4.0

Gallery Server Pro can run under .NET 2.0, 3.5, or 4.0. By default it is configured to run under .NET 2.0 with MS Ajax 1.0 Extensions. Since 3.5 and 4.0 include built-in Ajax support, you do not need the MS Ajax extensions when running under those versions. The only change that is required to run under .NET 3.5 or 4.0 is a switch to a different web.config file. GSP includes several variations of web.config, as seen here:

DifferentWebConfigFiles

There are six versions of web.config, but only one is necessary. Pick the one you need, rename it to web.config, and delete the rest. The versions with “sqlserver” in the name can be used in medium trust environments where SQL Server is the only data option. These have been purged of references to SQLite, which requires full trust.

For example, if you are installing to a freshly built server with .NET 4.0, rename the file web_4.0.config to web.config and delete the remaining config files. In this case, you do not need to have .NET 2.0, 3.0, 3.5, or MS Ajax Extensions installed.

Support for web archive files (.mht)

Thanks to a suggestion by a user, I added support for web archive files (.mht). These are files that contain web pages, including images, in a single file. You can create an MHT file by navigating to a web site in Internet Explorer and choosing the Save As… command. It is an efficient way to capture the contents of a web page at a single point in time, in a single file.

For example, I used Internet Explorer to save the home page of www.galleryserverpro.com to a file named gsp.mht and then I uploaded it to my gallery. Here is how it looks when viewed in Internet Explorer:

mht_in_ie

The MHT file is is displayed in an iframe. Notice how, even though it is a single file, it preserves the text, images, and styles of the original web page.

Unfortunately, only Internet Explorer can render MHT files. For other browsers, GSP gracefully degrades to a helpful message about your options for viewing it:

mht_in_chrome

This feature was implemented entirely by adding a few lines of text to galleryserverpro.config. All I did was define the MHT file extension:

<mimeType fileExtension=".mht" browserId="default" type="message/rfc822" allowAddToGallery="false" />

…and then define an HTML template to display this particular MIME type. Notice how I define the default template and then another one for Internet Explorer:

<mediaObject
  mimeType="message/rfc822">
  <browsers>
    <browser id="default"
      htmlOutput="&lt;p class=&quot;gsp_msgfriendly&quot;&gt;This browser cannot display web archive files (.mht). Use Internet Explorer or download it by clicking the download link in the toolbar.&lt;/p&gt;" />
    <browser id="ie"
      htmlOutput="&lt;p&gt;&lt;a href=&quot;{MediaObjectUrl}&quot;&gt;Enlarge to fit browser window&lt;/a&gt;&lt;/p&gt;&lt;iframe src=&quot;{MediaObjectUrl}&quot; frameborder=&quot;0&quot; style=&quot;width:680px;height:600px;border:1px solid #000;&quot;&gt;&lt;/iframe&gt;" />
  </browsers>
</mediaObject>

The ability to create and edit HTML templates to customize the display of media files is a powerful one that really sets GSP apart from the competition. The Admin Guide has more information if you want to explore this feature.

Easier integration into other web applications

Gallery Server Pro no longer requires anonymous identification to be enabled at the application level. Previously, the web.config file enabled anonymous identification so that GSP could store user preferences for anonymous users.

In previous versions, a problem appeared when developers tried to integrate the gallery into an existing web site that was incompatible with anonymous identification. For example, Yet Another Forum throws an error when this feature is enabled. Since GSP throws an error when it is disabled, you were in a no-win situation.

Anonymous identification was only marginally useful to GSP, as I really only used it to keep track of whether the user had requested the image metadata popup window to be visible. Since I could easily handle this with a session variable, I refactored the code to use session to store this info for anonymous users. Logged on users continue to store user preferences in profile properties, just like before.

The most significant aspect of this change is that the web.config file for the web application no longer needs this line:

<anonymousIdentification enabled="true" />

The versions of web.config that ship with GSP already have it removed. If you have integrated GSP into an existing version, you should remove this line. Also, update the profile property ShowMediaObjectMetadata to disable anonymous identification:

<add name="ShowMediaObjectMetadata" defaultValue="false" type="String" allowAnonymous="false"/>

Other enhancements

I will quickly mention the remaining enhancements.

  1. Backup file now compressed in ZIP archive. The Backup/Restore page in the Site Admin area now packages the backup file in a ZIP file before sending it to the user. Since the backup file is XML that is easily compressed, this creates a compressed file that is a fraction of the size of the original. You can restore with the zipped file, too, which is especially useful if you are on a network with a painfully slow upload speed.
  2. Files are guaranteed to be added in alphabetical order during a synchronization. Most users discovered that files added during a synchronization were added in alphabetical order of the file name, but for some people the order seemed random. I added a specific step where I sort the list of files that are given to me by the operating system before adding them to the gallery. This should ensure media files are always added in alphabetical order.
  3. Automatically clear deleted users from album owner field. This affects the small percentage of users who integrate GSP into an existing web site where users may be deleted by a mechanism other than the Manage Users page in the Site Admin area. For example, you might have implemented your own user management page. This change helps ensure data integrity.
  4. Improved date parsing of image metadata. Gallery Server Pro is now a little smarter about handling partial dates in image metadata. I am referring to dates that contain only the year or only the month and year. For example, if you used Adobe Photoshop Elements to specify a picture was taken in 2007 – without specifying the month or day - GSP could not correctly read the date. This has been fixed.

No comments: