Thursday, August 28, 2008

Version 2.1 Released!

I am pleased to announce the immediate availability of Gallery Server Pro 2.1. There are several new features and a couple dozen bug fixes.

The most important new feature is the use of the open source SQLite database engine for storing gallery data. SQLite is a self-contained, serverless, zero-configuration, transactional, ACID compliant SQL database engine. That is a mouthful, but it can be summed up as “It rocks!”. In fact, you are probably already a SQLite user, as it is the most widely deployed SQL database engine in the world. It is embedded in various Adobe products, Mozilla Firefox, and even in the Apple, Solaris, and Symbian operating systems.

The beauty of SQLite – at least as far as Gallery Server Pro is concerned – is that there is nothing extra to install. The data reside in a file named galleryserverpro_data.sqlite in the App_Data directory of your web application. GSP communicates with the database using System.Data.SQLite.dll, which is a .NET wrapper around the sqlite3.dll C library. This .NET wrapper greatly simplifies the coding, and I owe a great big thanks to its creator, Robert Simpson, at

During installation, you no longer have to mess with SQL configuration settings. The wizard asks you which database engine you want to use – SQLite or SQL Server. If you choose SQLite, then you enter the username and password you want to use for GSP administration, and you are done! Ba-da-boom, ba-da-bing!

SQL Server is still a first-class component, including SQL Server 2008 and SQL Server 2008 Express. You may want to use SQL Server if any of the following are true:

  • You are comfortable with SQL Server.
  • You are already using SQL Server and want to keep all your data in one place.
  • You are forced to run Gallery Server Pro in a Medium Trust environment and are not able to install System.Data.SQLite.dll in the Global Assembly Cache (GAC).
  • Your installation of GSP is mission-critical and you don’t want to take any chances with your data. Since SQLite is file-based, there are rare circumstances where the hard drive reports to the software that the data is written to disk, when in fact it has not yet done so. If, at this moment, your PC loses power, SQLite will think the data is safely stored, but it is not.
  • You are already using ASP.NET membership and have your users in SQL Server. For example, you may have DotNetNuke installed and want GSP to use the existing user accounts in your SQL Server DotNetNuke database.
  • You have other applications besides the GSP web application interacting with the data file. You may encounter file locking issues and slowed performance as multiple threads wrestle for access to the file. This is one of the few cases where a traditional client-server database such as SQL Server is clearly superior.

I believe the vast majority of you will find SQLite to be the best option, and there are a good number of you who wouldn’t consider using GSP before because you didn’t know a darn thing about SQL Server, and didn’t have the time or inclination to learn yet another thing. Now, you don’t have to know anything about SQLite, because it “just works”.

The second major feature is the use of Microsoft’s Silverlight plug-in to render wmv, wma, mp3, asf, and asx files. For example, here is Silverlight being used for an asf video:


You can start playing the video as soon as a few seconds are buffered. Previously, GSP typically rendered videos in an <object …> tag and let the browser figure out what plug-in to use. The plug-ins that I tended to have on my browsers always wanted to fully download the video before starting to play it, meaning you were often twiddling your thumbs. The old functionality is still available if you want (just edit the templates in galleryserverpro.config), but I believe most of you will appreciate the consistency and added features of Silverlight, especially as the plug-in becomes more widely installed.

If Silverlight is not installed on a user’s browser, a Microsoft-supplied image will appear that says Get Silverlight. When clicked, the user is shown a download page and stepped through the process of installing it. You have probably already seen this image on other sites that use Silverlight.

GSP also allows you to point to media objects stored on other servers. For example, when browsing videos on YouTube, you may have seen the embed code textbox on the side:


Copy this text to your clipboard and then navigate to the GSP Add objects page. Click the External content tab, and then paste the embed code, like this:


Click Add media object, and your gallery now has a link to the YouTube video! The video is not actually downloaded to your web server. Instead, the video is streamed straight from YouTube to your user’s browser. YouTube pays for the bandwidth! But it *looks* like it is on your server:


A lot of web sites are offering embed code for their videos. A few that I stumbled across are,, and

You can also upload your videos to Silverlight Streaming and link to them from your gallery. Again, the bandwidth is paid for by them, not you.

There are a lot of other new features and bug fixes that I won’t get into detail at the moment. Among them are significant improvements to the synchronization process, performance of very large galleries, and full support for IIS 7 Integrated Pipeline Mode.

I am proud of the new release, and I hope you enjoy it. If you have any questions, comments, or feature requests, please use the forums.

Friday, August 15, 2008

Version 2.1 Beta Released!

After many months of hard work, I am pleased to release the beta of version 2.1. It contains a few dozen bug fixes and several new features.

Download it here.

The most significant change is the use of the open source SQLite database engine to store the gallery data. SQLite is the most widely deployed database in the world and is embedded in products such as Firefox. All gallery data is now stored in a file named galleryserverpro_data.sqlite in the App_Data directory of the web application. SQLite does not have to be installed prior to installing Gallery Server Pro. All you need is a couple DLL’s in the bin directory and the .sqlite file containing the data, all conveniently packaged with Gallery Server Pro.

This should address one of the biggest headaches you experience with Gallery Server Pro – messing with SQL Server. SQL Server is an excellent client-server database, but it can be difficult to understand and configure. Furthermore, many hosting companies charge more for SQL Server.

SQLite is ACID-compliant and very fast - in many cases even faster than SQL Server. However, if you have several applications accessing the Gallery Server Pro database (that is, high concurrency), you cannot beat a traditional client-server database such as SQL Server. For those situations, Gallery Server Pro still supports SQL Server, including SQL Server 2008.

The only downside to SQLite is that it must run in a Full Trust environment, so some hosting companies – GoDaddy comes to mind – unfortunately cannot use SQLite.

New Features

  • SQLite is the default data store. Users can still use SQL Server if they wish.
  • Data backup and restore functionality.
  • Support for media objects hosted elsewhere, such as YouTube videos and Silverlight Streaming.
  • The Silverlight plug-in is now the default player for wmv, wma, mp3, asf, and asx files.
  • Language resource files have been consolidated into fewer files, which will make translation a bit easier.
  • Improved Add objects page, including better support for IIS 7.0 Integrated Pipeline Mode.
  • Improved performance for very large galleries. Performance tweaks allow Gallery Server Pro to run very fast even for galleries with hundreds of thousands of media files.
  • Increased robustness of synchronization process.
  • Support for SQL Server 2008

Bug Fixes

  • Synchronizing video and audio files does not update the original width and height values
  • Apostrophe in filename causes thumbnail to not render on rearrange page
  • Poor performance of manage users page when there are thousands of user
  • IE not caching images on the client
  • Install wizard does not show any databases in its dropdown list in certain hosting environments
  • Image metadata is sometimes extracted as the text "System.Int64[]"
  • Code references absolute URL when relative URL is sufficient
  • An album title with a trailing period or space causes an exception
  • Page times out when copying large numbers of objectsOut of memory when adding very large images
  • Objects added to a private album may incorrectly appear in search results
  • File lock not released for some files
  • Incomplete error information if an exception occurs when adding a user
  • Adding a user sometimes never returns from "Communicating with server..." message
  • Cannot manage users with ActiveDirectory provider
  • Album stats count hidden albums
  • URL occasionally incorrectly calculated when installed as root application
  • User cannot change password if e-mail functionality is not configured
  • User cannot change e-mail address on account
  • Certain images that previously synchronized fail during subsequent synchronizations
  • Dialog window with the text "true" appears when clicking the Show metadata toobar icon
  • Error during app startup if a role in gs_Role and aspnet_Roles differ only by case
  • Timeout error for very large galleries (> 40,000 albums)
  • Receive InvalidMediaObjectException during synchronization
  • Message not cleared after logging in
  • Thumbnail / optimized images sometimes created with wrong width/height
  • User does not receive friendly message when Gallery Server does not have delete permission to mediaobjects directory

Tuesday, August 5, 2008

Improved video handling in 2.1

It looks like Firefox will support the <video> tag in 3.1, due in 2009. It will join Opera, which already supports it. That is good news. Unfortunately, Internet Explorer 7 does not support it, and it doesn’t look like IE8 will either. Until all the major browsers support a standards-based approach, playing video in browsers will continue to be a challenge.

The current state of rendering video in browsers is pitiful. Browsers require a plug-in to play video, and web developers are not guaranteed that one is installed. The Flash plug-in is the most popular, and most video sites, like YouTube, convert their video to Flash format and embed it in a custom wrapper that offers play/pause and other functionality.

Gallery Server Pro uses the Flash plug-in for swf files, so if your animation or video is in this format, you are good to go. But Gallery Server can’t take your mpeg or wmv file and wrap it up in Flash for you. I believe there are ways to do this using open source converters, but it is not trivial to implement. If someone wanted to volunteer some time to add this, I would be happy to include it in a future release.

So what do you do when you want to post your videos in their native format, whether it is mpeg, wmv, mov, avi, or some other format? Or, more specifically, what should Gallery Server Pro do when you upload one of these videos? Should it assume a particular plug-in is installed? Should it convert everything to Flash?

There are pros and cons to each potential solution, and in the end I came up with a flexible HTML template system that provides a default solution, but allows you – the web administrator – to change it to conform to your needs. For example, version 2.0 will output the following HTML for most videos:

<object type="{MimeType}" data="{MediaObjectUrl}" style="width:{Width}px;height:{Height}px;">
  <param name="src" value="{MediaObjectUrl}" />
  <param name="autostart" value="{AutoStartMediaObjectText}" />

This produces XHTML 1.1 Strict syntax that lets the browser decide how to render it. If a plug-in is installed that can handle the MIME type, then it is used. If no plug-in is available, the browser may – or may not – give you some help in choosing and installing one.

This approach works reasonably well in current browsers, but older ones don’t handle the <object> tag very well. If backwards compatibility is more important than conforming to web standards, you can edit the template to use the <embed> tag. You can read more about this in the Admin Guide.

The introduction of Silverlight adds new possibilities, and the upcoming release of 2.1 will have new templates that use the Silverlight plug-in for wmv, wma, asf, asx, and mp3 files. One of the greatest benefits to the Silverlight control is the ability to start playing video once a few seconds have been buffered. Most plug-ins I had previously tested play the video only after it has been completely downloaded. So far this feature is working nicely, but I have been struggling with some issues with Firefox 3. It’s been a real cat and mouse game in figuring out the guilty party; I don’t know whether to blame Silverlight, Firefox, or the ComponentArt ASP.NET controls.

Probably the most robust and reliable way to play video in Gallery Server is to use the new External Content feature of version 2.1, and I am really happy with how this is working out. With this release, you add a media object to the gallery, *not* by uploading a file, but by pasting HTML code that refers to the media object hosted elsewhere. For example, every video on YouTube has embed code you can copy. It looks something like this:

<object width="425" height="344">
  <param name="movie" value=""></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="WMODE" value="opaque"></param>
  <embed src="" type="application/x-shockwave-flash" allowfullscreen="true" wmode="opaque" width="425" height="344"></embed>

The Add objects page in Gallery Server Pro now has two tabs: Local Media and External Content. The Local Media tab works like before, where you can upload media files to the gallery. The External Content tab allows you to paste the embed code, as seen here:

Add objects screen shot

When you view this media object, Gallery Server Pro embeds the HTML fragment as part of the entire page, where it will play the video directly from YouTube. The beauty of this approach is you get the benefits of YouTube’s technology for converting video and buffering content. Also, YouTube pays for the bandwidth. The video never actually passes through the web server Gallery Server Pro is running on.

You aren’t just limited to YouTube. You can also use Silverlight Streaming to host your video files, or add your favorite The Daily Show clips from Comedy Central. In fact, any HTML can be used. This is a powerful new feature, and I am sure some people will find applications for it that I haven’t even imagined.