Thursday, August 13, 2009

New Release Adds Support For Flash Video, H.264 and more

Today I posted the latest version of Gallery Server Pro. I added support for a few more media types, included a few new features, and fixed several bugs. Get it here.

Flash video and H.264

I blogged earlier about how to tweak your gallery to add support for Flash video and H.264 audio and video. Now it is included in the default installation. Note that you still have to enable the appropriate file extensions on the Media Object Types page in the Site admin area before you can add these media types. There are examples of videos in these formats in the video gallery.

Hidden directories ignored during synchronization

Starting with this version, any folders within the media objects directory will be ignored if it is marked as hidden. Use Windows Explorer to hide a directory, as seen here:

hiddendirectory

When a directory is hidden, it is ignored by GSP during the synchronization process.

Allow a membership or role provider to be specified by name

Prior to this release, GSP always assumed the default membership provider was the correct one. That is, GSP required the defaultProvider attribute for the membership, roles, and profile definitions in web.config to point to the the entry used by GSP. For example, by default GSP specifies the SQLiteMembershipProvider for membership in web.config:

<membership defaultProvider="SQLiteMembershipProvider">...</membership>

However, if you are integrating GSP into another application, this might create difficulty since your existing application may already have a default provider, and in some cases you want GSP to use a different one. Now you can go ahead and create the second provider definition in web.config.

<membership defaultProvider="YourMembershipProvider"> 
    <providers>
        <clear />
        <add name="YourMembershipProvider" applicationName="Your application" ...additional stuff here... />
        <add name="SQLiteMembershipProvider" applicationName="Gallery Server Pro" ...additional stuff here... />
    </providers>
</membership>

Then, in galleryserverpro.config, you tell GSP the name of the membership provider in the new membershipProviderName attribute:

<galleryServerPro>
  <core ... membershipProviderName="SQLiteMembershipProvider" ... />
  ...
</galleryServerPro>

After this change, GSP will use SQLiteMembershipProvider for membership and your existing application is unaffected. You can do the same thing with roles using the roleProviderName attribute in galleryserverpro.config.

I could not figure out a way to programmatically access a non-default profile instance, so profile behavior is unchanged.

Perhaps the best use for this feature is to keep the roles used by GSP separate from the ones used in your application. You already know that you can create roles in the Site admin area to manage the security access your users have to albums. In addition, the user album and owner features automatically create roles behind the scenes. When you have a large number of users and especially when you have the user albums feature enabled, you can end up with a lot of roles. Normally, this isn't a problem - in fact, that is exactly why roles exist. However, if you are integrating GSP into an existing application, you may not want all the extra roles interfering with your "regular" roles.

The solution is to configure GSP to separate the roles into their own application space. A little primer: The ASP.NET membership system can use a single data store for one or more applications. An application is uniquely defined by the applicationName attribute in the membership, roles, and provider definitions in web.config. In the <membership> example above, there are two applications defined: "your application" and "Gallery Server Pro". If you peek in the aspnet_Applications table in your database, you will see one record for each. If you add a third provider with a new app name, ASP.NET will insert a third record into that table.

OK, hopefully that is enough background. Here is how to configure GSP to use the same membership (that is, list of users) but isolate the roles into its own application space. First, in web.config add a definition for the role provider to be used by GSP:

<roleManager defaultProvider="YafSqlRoleProvider" ...>
<providers>
  <clear />
  <add applicationName="YAF" name="YafSqlRoleProvider" ... />
  <add applicationName="Gallery Server Pro" name="GspSqlRoleProvider" ... />
</providers>
</roleManager>

In this example, GSP is not the default role provider, so we must tell GSP which one to use. We do this in galleryserverpro.config:

<galleryServerPro>
  <core ... roleProviderName="GspSqlRoleProvider" ... />
  ...
</galleryServerPro>

SQLite users: If you use SQLite as your data store, there is one more step. Add the attribute membershipApplicationName to the role provider definition to tell the role provider the name of the membership provider that stores the list of users. So instead of the example above, it will look like this (replace "SQLiteMembershipProvider" with the correct name):

<roleManager defaultProvider="YafSqlRoleProvider" ...> 
<providers>
  <clear />
  <add applicationName="YAF" name="YafSqlRoleProvider" ... />
  <add applicationName="Gallery Server Pro" membershipApplicationName="SQLiteMembershipProvider" name="GspSqlRoleProvider" ... />
</providers>
</roleManager>

That is it. The roles needed by GSP are associated with GSP and the roles needed by the other application (in this case "YAF") are associated with it, and never the twain shall meet, even though they share the same list of users. As I said, I think this will be most useful when you do not want the roles used by GSP to clutter up the rest of your web application. Note that you may need to re-run the install wizard after making this change so that the admin account is correctly associated with the automatically created System Administrator role.

Bug fixes

There were a few bug fixes as well. You can view a detailed report of them on the Release History page.

Install and upgrade info

I have not yet updated the Admin Guide for this version, but the install and upgrade procedure is identical to previous versions, except for one small detail when upgrading. Before you upgrade, open gs\config\galleryserverpro.config and add the .m4a and .mp4 file extensions to the silverlightFileTypes configuration setting. That is, it should be ".mp3,.wma,.wmv,.asf,.asx,.mp4,.m4a". Then upgrade as normal. Later you will rename this file to galleryserverpro_old.config and run the Upgrade Wizard (see the Admin Guide for details). If you didn't make this change, the wizard would import the original value for this setting and you would find that Silverlight may not play your .m4a and mp4 files.