Tuesday, May 24, 2011

Bug: Thumbnail image not generated for PDF files

Today I discovered a bug that affects all galleries upgraded from a version earlier than 2.4.3. You are affected if all of the following are true:

  • You have PDF files in your gallery.
  • You originally installed GSP before version 2.4.3 and then upgraded to one of the later versions.
  • Your site is running in Full Trust.
  • You installed the Gallery Server Pro Binary Pack.

In short, this is a bug in the SQL upgrade script that shipped in 2.4.3 and later. Fortunately, there is an easy fix.

First, some background: In a default installation GSP creates a generic thumbnail image for PDF files, like this:

GenericThumbnailImage_PDF

When you install the Gallery Server Pro Binary Pack, GSP uses the ImageMagick and GhostScript utilities to generate a thumbnail image that is an actual preview of the PDF file:

AdminGuide_ss_116x145

Today I discovered a bug, introduced in 2.4.3, where PDF files *always* get the generic thumbnail image, even when the binary pack is installed. The cause of this is a typo in the SQL upgrade script for 2.4.3:

UPDATE [gs_GallerySetting]
SET [SettingValue] = 'pdf,.txt,.eps,.psd,.tif,.tiff'
WHERE [SettingName] = 'ImageMagickFileTypes';

See the typo? I missed the period in front of ‘pdf’. To fix your gallery, update the setting to include the period. You can use this SQL:

UPDATE [gs_GallerySetting]
SET [SettingValue] = '.pdf,.txt,.eps,.psd,.tif,.tiff'
WHERE [SettingName] = 'ImageMagickFileTypes';

Since these settings are cached, recycle the IIS application pool to force the gallery to get a fresh copy from the database.

The next version of GSP will include a fix for this.

Tuesday, May 10, 2011

jQuery 1.6 introduces breaking change

On May 3, jQuery introduced a new version that breaks some of the functionality of Gallery Server Pro 2.4.6 and higher. Earlier versions are not affected. Also not affected is the Gallery Server Pro DotNetNuke Module, *unless* you explicitly changed the default jQuery settings. The good news is there is an easy fix I describe at the end of this post.

Background

Gallery Server Pro uses jQuery to provide a rich user experience. Starting with 2.3.3750, a default installation of GSP uses the Google hosted versions of the jQuery library rather than a locally stored copy of the .js file. This allows the browser to use a previously cached copy of jquery, resulting in a faster loading page.

There are a number of ways one can construct the URL to point to Google’s copy of jQuery. Here are a few examples of how I’ve tinkered with the URL:

2.3.3750: http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js

2.4.0: http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

2.4.5: http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js

2.4.6 – 2.4.8: //ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

Notice how the version number is specified. By omitting the minor version from the 2.4.6 and later releases, Google automatically serves the latest 1.X release. You get the benefit of having the latest version of jQuery without having to explicitly upgrade.

But there is some risk with that approach, which brings me to the topic of this post. On May 3, jQuery released version 1.6. It contains a number of improvements and performance enhancements. Unfortunately, it also introduces a breaking change that causes an immediate problem on all 2.4.6 and higher Gallery Server Pro releases. Earlier GSP versions are not affected because the jQuery URL pointed to either a local jQuery file (versions earlier than 2.3.3750) or one of the 1.4 versions. jQuery 1.6 changes how attributes are handled. The details are in this blog post, but what it means to GSP is that the handling of checkboxes and the enabling/disabling of HTML elements in several of the admin pages are broken.

For example, as user happylynlyn pointed out yesterday in the forum, selecting the option ‘Override the following default settings’ on the Gallery Control Settings page no longer enables the child options. This issue also affects the Manage Roles, User Settings, and Metadata pages.

The issue only affects these few pages in the site admin area – browsing the gallery and performing tasks in the gallery (add/editing objects, etc) are not affected.

The Fix

I will have this resolved in the next release. Until then, there is an easy workaround – just tell Gallery Server Pro to use an earlier version of jQuery. On the Site Settings – General page, update the jQuery path to specify version 1.5:

jquery1.6fix