Thursday, September 5, 2013

Gallery Server Pro Binary Pack Updated

Today we released an updated version of the Gallery Server Pro Binary Pack. It contains the latest versions of three open source utilities that give you advanced gallery functionality such as audio/video encoding and video, PDF, and EPS thumbnail generation. They are ImageMagick 6.8.6, FFmpeg 2.0, and GhostScript 9.10.

To update your gallery, download the Binary Pack, extract the contents from the zip file, and copy convert.exe and ffmpeg.exe over the existing files in the bin directory of your web application. GhostScript is updated by copying gs910w32.exe in the GhostScript directory to your web server and then running it. If you are using a web hosting company, you likely aren’t allowed to run executables on the server. In this case, the best you can do is create a support ticket to ask them to do it.

Tuesday, August 6, 2013

Make the Silverlight XAML files play nice with your Visual Studio web app

Today I was building a web application with an embedded gallery when I hit a snag that wasted an hour of my time. The fix turned out to be simple so I decided to write it up to save you the same grief.

The issue only affects developers adding a gallery to an existing website using Visual Studio. To make deployment easier, I had grabbed the compiled version of GSP and added all the files in the gs directory to a gs directory in my web application. When I compiled the project, I was met with this error:

“Project file must include the .NET Framework assembly 'PresentationCore, PresentationFramework' in the reference list.”

I dutifully added project references to PresentationCore.dll and PresentationFramework.dll and tried again. This time I got 84 errors, all of which had one of these two messages:

“The tag 'Canvas' does not exist in XML namespace 'http://schemas.microsoft.com/client/2007'.”

“Each dictionary entry must have an associated key.”

The errors were generated by the XAML files included in Gallery Server Pro. These are the Silverlight media players for audio and video files and are used in some browsers for MP3, M4A, WMA and WMV files. Only AudioGray.xaml and Professional.xaml are actually used in a default installation, but you can modify the media templates to use any of the other players if you prefer their style.

xaml1

Anyway, so I tried to make the error go away by changing the namespace to a value that included Canvas. That is, I opened one of the files (AudioGray.xaml) and changed the first line from:

<Canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="404" Height="40">

to this:

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="404" Height="40">

That got rid of the first error. To get rid of the second error I had to add x:Key to each element that required it. For example, I changed this:

<Storyboard x:Name="PlayPauseButton_MouseEnter">

to this:

<Storyboard x:Key=”A1” x:Name="PlayPauseButton_MouseEnter">

After tediously applying unique keys to dozens of elements, those errors disappeared. Unfortunately, two new ones appeared:

“VideoBrush is not supported in a Windows Presentation Foundation (WPF) project.”

“The tag 'VideoBrush' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'.”

After a bit of research I discovered that VideoBrush exists only in the Silverlight version of System.Windows.dll, which-as far as I can tell-cannot be referenced from a WebForms ASP.NET app. I seemed dead in the water.

The 10-second solution

Then it dawned on me to look at the build action property for the XAML files. They were set to Page:

xaml2

Aha! All I want Visual Studio to do with these files is copy them to the web server during deployment. They are not Silverlight pages and should not be compiled or parsed. To tell VS to treat them as content, change the build action to Content. Once I did that, the project compiled.

That’s the long story. The short story is this: When you include the XAML files from Gallery Server Pro in your web application, change the build action to Content. That’s it. You don’t need the references to PresentationCore.dll or PresentationFramework.dll or any of the other monkeying around I did.

Really, I should have thought of that first, but you know how it goes sometimes. Maybe this post will save you some debugging time.

Friday, August 2, 2013

New live demos for Gallery Server Pro

Today we rolled out several new demos of Gallery Server Pro highlighting key features.

Standard Media Gallery (dark theme) – This is a gallery installed with default options and loaded with a variety of images, videos, audio and documents. This gives you an inside look at what your gallery will look like out of the box. You can log in with username Demo (password “demo”) and add, edit and delete items in the Upload album.

Standard Media Gallery (light theme) – Configured identically to the dark themed gallery except it uses the light theme.

E-Commerce Gallery – Set up to mimic a professional photographer selling their photos in a variety of styles. Integrated with PayPal, you can easily imagine other e-commerce scenarios, such as selling clothes, objects or other physical goods.

The look and feel of the e-commerce gallery is dramatically different than a default gallery, yet no code changes were required. That’s right – no .NET or C# skills were necessary to make these changes. It was all done through edits to the settings and UI templates. As my five year old would say – “easy peezy lemon squeezy”!

More demos will be appearing in the coming days to highlight other features such as user albums (community galleries), watermarking, and the ease of integrating a gallery into an existing site.

Wednesday, July 31, 2013

Last day for $100 savings!

This is a friendly reminder that today is the final day to save $100 on Gallery Server Pro Enterprise. This is the premier package of Gallery Server Pro, containing all the benefits of the GPL and GPL Professional versions while adding some really nice features, such as SQL Server/Azure support (which is up to 20 times faster than SQL CE!), guaranteed forum support, a commercial license and sample PayPal and Facebook templates.

Get it before time runs out.

Thursday, July 11, 2013

Gallery Server Pro 3.0 API Documentation Released

Today I released the Gallery Server Pro API Documentation, freshly updated for 3.0. This is primarily a resource for developers who want to better understand  the namespaces and classes used in Gallery Server Pro.

Previous versions were released as a chm file, but this time I decided to post it as a set of web files. This makes it easy for anyone to reference and doesn’t require a download.

Friday, July 5, 2013

Gallery Server Pro 3.0.1 Now Available in Web Application Gallery and Azure Gallery

On July 3 Microsoft updated its version of Gallery Server Pro in the Web Application Gallery and Azure Gallery to the latest 3.0.1 version. These versions make it easy to get up and running with a gallery without having to think about IIS settings, databases or other technical details.

Web Application Gallery

There are three ways to install a gallery from the Web Application Gallery:

IIS Manager

When you have access to IIS Manager, I recommend this approach. Open IIS Manager, navigate to your website, then select Install Application From Gallery in the right pane:

wag1

If you don’t see the link, install the Web Platform Installer.

Select the Applications tab, click Galleries from the left pane, then select Gallery Server Pro. Click Add, then Install.

wag2

Follow the prompts to finish the installation. Pretty easy.

Web host control panel

Many hosting companies are integrated with the Web Application Gallery, which offers an easy way to install Gallery Server Pro that avoids having to FTP the files to your site and configure permissions. For example, the Arvixe Control Panel has a Hosting Spaces section with a link to the WAG:

wag3

Click it and follow the wizard to install a new gallery instance to your website.

Note: I have seen cases where the hosting control panel defaults the application pool to Classic Mode. Gallery Server Pro requires Integrated Mode, so if you have any trouble, check this setting. Go into the Web Sites section, select your website, then check the Extensions tab:

wag4

Web Application Gallery website

The Web Application Gallery website lets you install Gallery Server Pro using the Web Platform Installer, which you will be prompted to install if necessary.

wag5

When you install through the Web Application Gallery website, Microsoft also installs WebMatrix and configures the gallery to run in local-only mode. The idea is that you can configure the gallery and then use the deploy feature in WebMatrix to push it to its final destination, which can be Azure, an FTP site, your web hosting company, or any other IIS destination.

This option has caused confusion with users who wonder why the gallery they just installed isn’t publicly available. Just remember that you have to publish it somewhere, even if it’s just pushing it to IIS on the same server.

Azure Gallery

Getting a gallery up and running in Azure takes just a few clicks. From the Azure Portal, click New in the lower left corner:

azure1

Then select WEB SITE and FROM GALLERY:

azure2

Select the Galleries category on the left, then Gallery Server Pro:

azure3

Click the next arrow, then enter your desired URL. Change the region if desired and finally select the checkbox to create the gallery:

azure4

After a few moments, your gallery is created:

azure5

Click the URL to view the gallery and set up the admin account:

azure6

Once the admin account is created, your gallery is ready to use.

Switch to SQL Server

The Web Application Gallery of GSP uses SQL CE as the database, but you can easily switch to SQL Server if you wish. Any time after installation, open web.config in a text editor (found in the root directory of the gallery). Update the connection strings section so that a connection named GalleryDb points to SQL Server. The easiest way to do this is to comment out the SQL CE connection, uncomment the SQL Server example, and edit it to point to your SQL Server. When you are done, it will look something like this:

<connectionStrings>
<clear />
<!--<add name="GalleryDb" providerName="System.Data.SqlServerCe.4.0" connectionString="data source=|DataDirectory|\GalleryData.sdf" />—>
<add name="GalleryDb" providerName="System.Data.SqlClient" connectionString="server=(local);uid=;pwd=;Trusted_Connection=yes;database=GalleryServerPro;Application Name=Gallery Server Pro;MultipleActiveResultSets=True" />
</connectionStrings>


The <!-- … --> around the first connection tells ASP.NET to ignore it, while the second connection instructs the gallery to store data in a SQL Server instance on the local machine in a database named GalleryServerPro, connecting with Windows Authentication. Save your changes.



Now go to the App_Data directory and add an empty text file named install.txt. If there already is one, you can skip this step. Gallery Server Pro detects this file and allows the creation of an admin account when present.



Use your browser to navigate to the gallery. Startup code will add the necessary tables and seed data to the SQL Server database and a message will appear instructing you to create an admin account. At this point the gallery is using SQL Server. The old SQL CE database at App_Data\GalleryData.sdf is no longer used and can be deleted.



These steps won’t migrate any data from SQL CE. There is a way to do that – consult the Admin Guide for details.



There you have it – several new ways to easily install a gallery!

Friday, June 28, 2013

Gallery Server Pro 3.0.1 Released

Today I released 3.0.1, containing 35 bug fixes and 9 enhancements. They include fixes to the 2.6 => 3.0 upgrade process, performance improvements, media template tweaks, and more.

This release is a free upgrade to 3.0.0 license holders. Upgrading is easy – just copy the files from the upgrade package over your existing web application. Installations and upgrades for other scenarios are in the Quick Start Guide.

Upgrade improvements

Several issues with upgrading from 2.6 have been addressed.

Lost media type settings – The upgrade to 3.0.0 caused the list of enabled media object types to reset to the default values of .jpg and .jpeg. Upgrades now preserve the settings you selected on the Media Object Types page in the site admin area. Note that if you already upgraded to 3.0.0, applying 3.0.1 will not correct this – you still need to re-enable the desired file types. But anyone upgrading from 2.6 to 3.0.1 will now have their file type settings preserved.

SQL timeout during restore – For large galleries, the default SQL Server timeout value of 30 seconds was not enough time to delete  and/or insert records. The value was increased to 3600 seconds (one hour).

Tags not imported – Users upgrading galleries with images that had tags (also called keywords) extracted from the file metadata discovered they were missing in 3.0. That has now been fixed, along with a couple other bugs where tags longer than 100 characters or those having apostrophes caused the upgrade to fail. If you were affected by this issue, you can (1) rebuild the tags on the Metadata page or (2) install 3.0.1 and perform the upgrade again.

Out of memory error – The backup and restore operation is a memory intensive operation and can fail for very large galleries (e.g. hundreds of thousands of media files). If you experience an out of memory error while creating the 2.6 backup file, see this thread for a patch. Version 3.0.1 has a more efficient restore algorithm, which should reduce the chance of exhausting the memory.

Incorrect .mp4 encoder setting – When you upgraded from 2.6 to 3.0.0, the .mp4 encoder setting on the Video & Audio page in the site admin area began with this text:

-y -i "{SourceFilePath}" -s {Width}x{Height} -b:v 384k …

But if you installed from scratch you got this setting:

-y -i "{SourceFilePath}" -vf "scale=min(iw*min(640/iw\,480/ih)\,iw):min(ih*min(640/iw\,480/ih)\,ih)" -b:v 384k …

Using –s {Width}x{Height} works, but it creates the encoded video with the same width and height as the original. Just before I released 3.0.0, I realized it would be better to scale the videos to a reasonable size so that the browser wasn’t trying to render ridiculously large videos. For example, videos from my Samsung Galaxy S4 are 1920x1080, but for most users it is overkill to serve videos at this size, not to mention the difficulty showing a large video on a monitor smaller than the video. So for 3.0.0 I changed the setting to the value shown above, where it is scaled to around 640x480, with the exact dimensions adjusted to preserve the aspect ratio. However, I forgot to update the setting in the upgrade script, so upgraders got the original setting. When you upgrade to 3.0.1, the setting is automatically updated, but if you prefer the original value, you are free to change it back (or to anything else you see fit).

If you have any issues with your upgrade, I want to hear about it. I may be able to upgrade your gallery even if you continue getting an out of memory error.

Performance enhancements

A couple of performance improvements have helped make the gallery a little more snappy. When the left pane is disabled on the Gallery Control Settings page, the data for the album treeview is no longer required. Version 3.0.1 now detects this scenario and skips the calculation, JSON serialization, and sending of the data to the browser.

I was also able to eliminate a duplicate JavaScript variable containing gallery settings.

Media template tweaks

After 3.0.0 was released, I noticed a few of the media templates were unnecessary or incorrectly configured. For example, .m4v, .qt, and .moov files were configured to play with an object tag in all browsers except Safari, which specified the HTML5 video tag. After upgrading to 3.0.1, these files will behave the same as .mp4, using the HTML5 video tag in browsers that support it and a fallback to Flash in those that don’t.

Also, .mp3 files wouldn’t play in IE8 and earlier because it doesn’t support the HTML5 audio tag. I added a new template that uses a Silverlight player for IE 1-8.

Updated album thumbnail styling

Version 3.0.0 used a different background color and a CSS double border on album thumbnails to differentiate albums from media objects:

abm_thmb_double_border

A few days ago I was helping a fella named Joe Hakooz with his gallery and I noticed he had tweaked the CSS to look a little more like a photo album. He was kind enough to let me copy his technique, and you can see the results here:

abm_thmb_triple_border

The neat thing is that it’s done all in CSS, but instead of specifying a double border, it uses the CSS3 box-shadow property:

box-shadow:0 0 0 0 #545454, 2px 2px 0 0 rgb(167,167,167), 4px 4px 0 0 #545454, 6px 6px 0 0 rgb(167,167,167)

By specifying a comma separated list of properties with alternating colors, I can create a nifty album look without custom images or the extra HTTP request it would require. Thanks Joe!

By the way, in case you are wondering why I mixed hex and RGB values, that is necessary for the MSBuild script I use when creating the light skin CSS file automatically from the dark skin. I have a standard set of replacement colors for hex values, while any colors specified in RGB are either not converted or handled in a separate step. The details are beyond the scope of this post, but I didn’t want you to think I am a sloppy programmer. Smile

The full list

Below is the full list of bugs and enhancements. I am still working on creating detailed reports with additional details. They’ll be posted on the release history page when finished.

Bug fixes

  • UI appears to allow editing album meta even when user does not have edit album permission
  • SQL timeout during restore
  • jQuery updated to 1.10.0 instead of 1.10.1 during 2.6 migrations
  • Saving changes on User Settings page unsets 'send an e-mail to the following admins when account is created' option
  • Edit options are sometimes incorrect
  • Image used when watermark can't be applied is not present
  • Media object not visible in IE8
  • Media object header section left aligned when toolbar disabled
  • Media template incorrect for M4V files
  • MP3 audio files do not play in IE8 and earlier
  • Thumbnails do not flow correctly on edit titles page
  • Web.API calls return 404 in some configurations
  • Cannot add a ZIP file on the add objects page
  • Concurrency error when trimming event log
  • Cannot assign thumbnail when gallery is read only
  • Download/share dialog hidden when viewing PDF file on Safari
  • Redundant MP3 media template for Safari
  • .qt and .moov files should use same media template as .mov
  • Keywords not correctly imported in 2.6 to 3.0 upgrade
  • Keywords longer than 100 characters cause 2.6 to 3.0 upgrade to fail
  • Keyword containing apostrophe causes 2.6 to 3.0 upgrade to fail
  • Link to product key page is incorrect
  • Space missing from 'Date Added' metadata label
  • GetDataSchemaVersion function very inefficient
  • Label incorrect on on Gallery Control Settings page
  • Duplicate settings object sent to browser
  • Can't edit title or caption of root album after 2.6 to 3.0 upgrade
  • Web.API call to /api/albums/{AlbumId}/galleryitems stores sort request as user's preferred sort order
  • Incorrect MP4 encoder string in 2.6 to 3.0 upgrade
  • A user is shown an Add link in an empty album even when they do not have add media object permission
  • Subsequent failed logins shows an empty green message box
  • Sync error can occur when filename is different than the metadata filename value
  • NullReferenceException if user without edit permission navigates to transfer objects page
  • List of enabled media objects is reset during upgrade
  • Thumbnail assigned to album during synchronization is not always the first file in directory

Enhancements

  • Improve ability to format dates and numbers within UI template
  • Make common jsRender helper functions and converters globally available
  • Silently handle errors that occur during metadata extraction and record file path
  • Add ability to specify sort on Web.API method /api/albums/{AlbumId}/mediaitems
  • Lock icon has misleading text when anonymous browsing is disabled
  • Perf improvement: Calculate and send album tree data only when required
  • Periodically persist the synchronization status to the database
  • Improve thumbnail distinction between albums and media objects
  • Update to jsRender 1.0 beta