Monday, April 1, 2013

Add a PayPal shopping cart and Facebook to your gallery in 10 minutes

Probably the most exciting feature in 3.0 is the template engine that generates the UI from jsRender templates. They are easy to modify and don’t require .NET or C# programming experience. This feature gives you the power and flexibility to mold the gallery experience to fit your website requirements and UI style guidelines.

There is a lot to write on this topic, but let’s start with a demonstration to show how easy it is. We’ll customize a default installation of the 3.0 beta to add these features:

  • Add a Facebook ‘Like’ button for every gallery item.
  • Add the Facebook comment widget to allow discussions for each gallery item.
  • Add PayPal ‘Add to cart’ and ‘View cart’ widgets to let users add gallery items to a shopping cart and manage them.
  • When users are ready to complete their purchase, they use the secure payment process provided by PayPal. PayPal notifies the website owner of the purchase via e-mail and optionally a programmatic callback, who can then take the necessary action (ship items, add user to new role, etc).

We can make all of these changes on the new UI Templates page in the site admin area. Here is what it will look like when we’re done:

uitmpl17

You can see these changes in action in the beta site. This tutorial combines Facebook and PayPal integration and applies it to the entire gallery, but in the beta I split them into two child albums: Facebook album and PayPal album

NOTE: Be sure you are using the latest version of the beta. This tutorial requires a version of the beta that was released today (April 1) or later. You can check your own version by looking at the date modified timestamp on GalleryServerPro.Web.dll in the bin directory. It should be April 1, 2013 or later.

Download Gallery Server Pro 3.0 Beta
Download Gallery Server Pro 3.0 Beta (source code)

More info, including install instructions

 

Facebook ‘Like’

Let’s add a ‘Like’ button at the top of the right pane each time a media item is displayed:

uitmpl6

Go to the UI Templates page in the Site admin area and select RightPane in the Gallery item dropdown:

uitmpl1

We want to modify the right pane template, but we don’t want to mess with the default one in case we want to revert back to it and to eliminate the possibility of our changes getting overwritten during an upgrade. So click Copy as new, type Facebook & PayPal Integration for the name and click Save:

uitmpl2

Before we continue with our new template, we want to deactivate the default one. Select Default from the Name dropdown, click the JavaScript tab, uncheck all the albums, and save.

uitmpl3

At this point our new template is being used to render the right pane. Go back to the new template by picking it from the dropdown.

Adding a ‘Like’ button requires some HTML and JavaScript. Facebook provides the code we can use as a starting point, but we need to tweak it a bit. The code is not specific to any Facebook account so you can just copy and paste the text I use here:

HTML:

<div id="fb-root"></div>
{{if MediaItem != null}}
<iframe src="//www.facebook.com/plugins/like.php?href={{:App.HostUrl}}{{:App.CurrentPageUrl}}?moid={{:MediaItem.Id}}&amp;width=450&amp;colorscheme=dark&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:400px; height:27px;display:block;margin:5px 0 0 5px;" allowTransparency="true"></iframe>
{{/if}}

JavaScript:

(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));

$('#{{:Settings.MediaClientId}}').on('next.{{:Settings.ClientId}} previous.{{:Settings.ClientId}}', function() {
if (typeof (FB) != 'undefined') FB.XFBML.parse();
});

Paste the HTML in at the beginning of the HTML template and paste the JavaScript in at the end of the existing script, then save.

uitmpl4

uitmpl5

This code differs from the sample Facebook provides in two respects:

Conditional rendering – There will be times when we don’t have a single media item in scope when the right pane is rendered. This happens, for example, when the user drags a select box around several thumbnails. In this situation, the right pane displays a summarized view of all selected items, and since we can’t generate a unique URL to give to Facebook that represents this situation, we don’t want to render the like button. So we wrap the iframe in a jsRender if conditional ({{if …}}…{{/if}}) that checks the client API to see if we have a single media item available. When we do, the contents of the if statement are rendered; otherwise we just skip that chunk of HTML.

Replacement parameters – We need to generate a unique URL to give to Facebook to represent the media item being liked. We construct it from several properties available to us in the client data model:

{{:App.HostUrl}}{{:App.CurrentPageUrl}}?moid={{:MediaItem.Id}}

As the page is being rendered in the browser, jsRender replaces each {{..}} section with the property referenced inside. So what gets generated in the client-side HTML ends up being a real URL:

http://beta.galleryserverpro.com/default.aspx?moid=3502

The JavaScript code does two things:

  1. It dynamically loads the Facebook JavaScript library.
  2. It calls the Facebook parse routine each time the next and previous media event occurs. Without this, the like button would appear when the page first loads, but not as the user navigates between items with the next and previous buttons.

Now navigate to a media object and notice the like button. It works just like you would expect, and if that’s all you wanted to do to your gallery, you are done. But let’s keep the sweetness going.

uitmpl6

 

Facebook Comments

Facebook offers a comment widget that lets you add discussion capability to any website. It includes moderation tools and even lets users log in with providers other than Facebook, such as Yahoo, AOL, and Hotmail. Let’s add the widget under each media item.

On the UI Templates page, select the MediaObject template, create a copy of it named Facebook & PayPal Integration, and save it. Then switch over to the default template, uncheck all the albums associated with it, and save. We’re doing the same thing we did with the right pane template – making a copy and activating it.

Here is the HTML provided by Facebook, tweaked to replace the static URL with a dynamic URL:

<div class="fb-comments" data-href="{{:App.HostUrl}}{{:App.CurrentPageUrl}}?moid={{:MediaItem.Id}}" data-width="470" data-num-posts="10" data-colorscheme="dark"></div>

We’re constructing an URL using replacement parameters the same way we did with the like button. Paste it in at the location shown here and then save.

uitmpl7

We didn’t have to add JavaScript this time because the script we added for the like widget also covers us here. If we hadn’t added the like widget, then we would have had to add that script into our template here. Now view a media object and start adding comments:

uitmpl8

 

PayPal Integration

Now let’s add e-commerce to our gallery with the widgets provided by PayPal. Your media items can represent anything you want to sell – photographs, videos, or physical objects like clothing or toys. When your customers finish paying at PayPal, you get an e-mail with details about the purchase, including the title of the media item and its unique ID (this corresponds to the moid query string parameter and the ID column in the media objects table in the database).

Advanced admins can even configure PayPal with a callback URL that can programmatically receive the purchase details and take action without human intervention. One example might be to add the buyer’s account to a role that gives them access to the high resolution version of the images they purchased.

The first step is to set up a PayPal account and use their button wizard to generate the HTML for the ‘Add to cart’ and ‘View cart’ buttons. PayPal has excellent documentation for this process, so I’ll refer you to that. Here is the code PayPal provides for the add to cart button that links to my account:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="JP2UFSSRLBSM8">
<input type="image" src="
https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="
https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

We need to make a few modifications to it before we can use it in our template:

<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="JP2UFSSRLBSM8">
<input type="hidden" name="item_name" value="Photograph - {{:MediaItem.Title}} (Item # {{:MediaItem.Id}})">
<input id='{{:Settings.ClientId}}_addToCart' type="image" src="
https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="addToCart" alt="PayPal - The safer, easier way to pay online!" style="padding:5px;">
<span style='display:inline-block;vertical-align:top;margin-top:10px;'>$1.00</span>
<img alt="" border="0" src="
https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">

Remove the form – ASP.NET renders all page content inside a form, and we can’t nest forms, so we remove the beginning and ending form elements.

Add item_name – We add a hidden input tag named item_name that holds the description of the item and it’s ID. This is picked up by PayPal to describe the purchased item in the invoice.

Add ID to button – We add a unique ID to the button (the input tag of type image). We do this so we can get a reference to it in JavaScript – more on that below. The ID includes the ClientId property to ensure it is unique even if multiple instances of a gallery are on a single page. That is not common but better safe than sorry, right?

Add the price – We add a span tag with the price. This is just for display purposes. The real price is stored on the PayPal server and cannot be overridden for security reasons. If you need different prices on your items, you can generate additional button templates at PayPal or use the PayPal API.

Paste the code into the HTML area of the right pane template named Facebook & PayPal Integration. We can add it right next to the Facebook code we added earlier:

uitmpl9

We also need to construct a bit of JavaScript:

var bindAddToCartButton = function() {
$('#{{:Settings.ClientId}}_addToCart').click(function() {
  var f = $('form')[0];
  f.action = '
https://www.paypal.com/cgi-bin/webscr';
  f.submit();
  return false;
});
};

$('#{{:Settings.MediaClientId}}').on('next.{{:Settings.ClientId}} previous.{{:Settings.ClientId}}', function() {
bindAddToCartButton();
});

bindAddToCartButton();

This script does the following:

  1. Adds an event handler to the click event of the add to cart button to submit the form to PayPal.
  2. Binds this event handler when the page loads and also when the user clicks the next/previous buttons.

Paste this script in after the Facebook code, like this:

uitmpl11

Save it and take a look:

uitmpl10

When you click the button you are redirected to PayPal where you can see your cart:

uitmpl12

Click the Continue Shopping button to return to the gallery, where you can add other items. At this point you can check out and complete your purchase anytime you add an item, but it would be convenient to add a view cart button to the top of the page. Let’s do that next. The HTML PayPal provides for viewing a cart looks like this:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="…encrypted text removed…">
<input type="image" src="
https://www.paypalobjects.com/en_US/i/btn/btn_viewcart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="
https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

We’ll include some of the same modifications we did to the add to cart button – remove the outer <form> tag and add an ID to the image button:

<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="…encrypted text removed…">
<input id="{{:Settings.ClientId}}_viewCart" type="image" src="
https://www.paypalobjects.com/en_US/i/btn/btn_viewcart_LG.gif" border="0" name="btnPayPal" alt="PayPal - The safer, easier way to pay online!" style='float:right;margin-top:5px'>
<img alt="" border="0" src="
https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">

Create a copy of the header template, call it Facebook & PayPal Integration, and deactivate the default one (just like with the media object and right pane templates). Then paste the HTML into the HTML template at the point where you want the view cart button to appear. In this example I’m putting it just before the {{if Settings.ShowLogin}} line:

uitmpl13

We need to wire up some script to submit the form when clicked, just like we did with the add to cart button. It can be a little simpler than that code, though, because we don’t need to bind it to next/previous events. That’s because the header is generated once when the page loads, while the right pane gets regenerated on each next/previous event. Here is the code::

$('#{{:Settings.ClientId}}_viewCart').click(function() {
var f = $('form')[0];
f.action = '
https://www.paypal.com/cgi-bin/webscr';
f.submit();
return false;
});

Select the JavaScript tab and add the script.

uitmpl18

Save your changes and notice the view cart button at the top right:

uitmpl16

Summary

We’ve integrated Facebook and PayPal into the gallery by doing nothing more than editing a few of the templates. Here is the final result:

uitmpl17

This is just one example of the power of the new UI templates feature. Future posts will dig into the client data model and some of the other new features. Have fun!

Friday, March 22, 2013

V3.0 Beta Refreshed

Today I released an updated beta version of Gallery Server Pro 3.0. Get it here:

Download Gallery Server Pro 3.0 Beta
Download Gallery Server Pro 3.0 Beta (source code)

See a demo of the beta here.

There is no support for upgrading an earlier beta. Delete the first beta and install this anew.

NOTE: An authentication cookie left over from the beta can trick the new version into thinking you are logged on, causing a problem when it can’t find a record for the user in the database. To prevent this, log out of your browser before deleting the beta.

The refresh includes these changes:

  • Many bug fixes, including most or all of the ones reported in the beta forum.
  • Changed upload page to use plUpload 1.5.6. (The 2.0 beta had some stability issues.)
  • Replaced the HTTP handler that receives file uploads to use an architecture based on Rick Strahl’s excellent Westwind.plUploadHandler.
  • Switched to a thread-safe architecture for storing albums and media objects in cache.
  • Albums are automatically resorted when objects are added via synchronizations and file uploads.
  • ZIP file uploads are extracted and processed asynchronously instead of forcing the user to wait.
  • Modified the architecture of the next/previous workflow so that the MediaObject UI template has access to all metadata items. That is, you can use the new jsRender function findMetaItem(metaId) to grab any meta item. Read this thread for an example.
  • Improved robustness of synchronization.
  • Improved performance when setting the privacy of an album. The action now occurs asynchronously.

Thursday, March 14, 2013

Gallery Server Pro 3.0 Beta Released!

I can’t tell you how excited I am to be releasing the beta of the groundbreaking 3.0 release of Gallery Server Pro. Two years in the making, it offers a beautiful user interface that is easy to use while giving administrators power and flexibility that no other digital asset management program offers.

Download Gallery Server Pro 3.0 Beta
Download Gallery Server Pro 3.0 Beta (source code)

See a demo of the beta here.

Be sure to add the Download Gallery Server Pro Binary Pack to get video/audio encoding, better thumbnail extraction, and more.

gsp_v3_beta1

Here is a quick rundown of the features:

  • UI completely rewritten using modern HTML5/CSS3
  • Three-pane layout minimizes scrolling
  • UI is rendered from customizable jsRender templates. Templates can target individual albums.
  • Video now encoded to H.264 MP4 video by default, allowing video to render on iOS, Android, and Microsoft ecosystems
  • Ability to tag media and albums, then create virtual albums matching those tags.
  • Apply properties to media and albums (editable metadata)
  • Full screen slide show
  • Able to browse through search results as if they were an album
  • Skinned user interface – ships with dark and light skins
  • Rate media objects on a 5-star scale
  • Flexible sorting
  • Adaptive rendering for mobile devices and tablets

Under the hood, there are significant changes as well:

  • New data provider model eliminates database-specific code and makes data upgrades significantly easier (EF Code First with Data Migrations)
  • Removed ComponentArt dependency and replaced with jQuery widgets
  • Removed dependence on MS Ajax library and ScriptManager
  • Replaced ASMX web services with Web.API
  • Simplified solution architecture to reduce number of projects from 11 to 6.
  • JavaScript follows modern patterns such as the Revealing Prototype Pattern and Revealing Module Pattern, with no variables exposed to the global scope.

Over the next few weeks I will explore these features in additional blog posts, but you’ll find some good stuff in the posts where I announced the Public Preview of Gallery Server Pro 3.0 and the announcement of GSP 3.0.

Requirements

Version 3 requires .NET 4.5 and ASP.NET on the server. This is a change from 2.6, which required .NET 4.0. By default it uses an internal SQL CE database, but you’ll get faster performance with SQL Server 2005 or higher, including the free Express versions.

Clients need only a web browser, with no dependencies on any plug-ins except where necessary to play certain media files (for example, playing MP4 on Chrome and Firefox requires Flash). Current versions of all major browsers have been tested and work well.

Installation

NOTE: This is pre-release software and does not include support for upgrading earlier versions of GSP, nor is there any guarantee you will be able to migrate to the release version. The final version will, however, support upgrading from 2.6.

Installation is improved from previous versions, which used an install wizard to guide you through database creation and admin account setup. I simplified it to the point where no install wizard was needed. Follow these steps:

  1. Extract the zip file to a directory. Configure the directory to run as an application in IIS under .NET 4.5. Make sure the IIS process identity has modify permissions to the App_Data and gs\mediaobjects directory.
  2. SQL Server only: To use SQL Server, open web.config and comment out the SQL CE connection string named GalleryDb. Add a connection string for your SQL Server – you can uncomment the sample SQL Server connection string in the file. Be sure it is named GalleryDb. If the specified database does not exist, the gallery will attempt to create it when the app starts.
  3. Open default.aspx in a web browser. The database will automatically be configured and seeded with default data. This step may take a minute or two, so be patient. The screen will look like this:

    gsp_v3_inst1
  4. Click the link to create an admin account. Enter a username and password and you are all set!

gsp_v3_inst2

gsp_v3_inst3

Running from Source Code

You can open the source code in Visual Studio 2012, including the free Visual Studio Express 2012 for Web. You should be able to compile and run the gallery without any additional dependencies.

Known Issues & Removed Features

These are the known issues:

  • Album treeview and splitter panes do not work in IE 8 and earlier
  • The light skin is not finished. In fact, it is exactly like the dark skin with only the page background color changed. This is a good opportunity for a volunteer to jump in – all you need to do is edit the colors in gallery.css and pick new icons for the gs\skins\light\images folder.
  • No support for upgrading from earlier versions
  • The backup/restore feature is not functional.
  • Concurrency error sometimes occurs when multiple users request an album at the same time

The following features existed in 2.6 but were removed in 3.0:

  • The start and end dates for albums no longer exist in the UI. These tended to cause confusion and were not used by many people. However, the API still supports them so it is possible to modify the UI template to add them back.
  • There are a couple places on the gallery settings and user settings pages where all user accounts were displayed in a drop down. Those dropdowns now include only those users who are site or gallery admins.
  • Cannot re-extract metadata during a sync. This feature has been replaced by the metadata rebuilding options in the site admin metadata page.

Final Release & Reporting Issues

I hope to release the final version within a couple months. It will be driven by the time it takes to put the last few things in place (that is, implementing an upgrade algorithm and fixing the issues).

Please report any issues on the beta forum or e-mail me at roger *at* techinfosystems *dot* com. Remember that I can only fix problems that I know about.

New License Option & DotNetNuke Version

I expect to continue providing a free GPL version of GSP, just like now. But I have heard from many of you that you would like a commercial license option, so I am looking into making that possible. A commercial license will free you of the GPL restrictions, such as having to publicly provide the source code for any changes you make. In addition, I may offer guaranteed support options.

Adding a commercial license option will help me continue to be able to focus on improving GSP instead of taking on paying contracts that distract me from this project. I cannot stress enough how important your donations are to keeping this project alive. I thank you for your support and humbly request that you provide a contribution to the best of your ability.

Once the final release is out, I will focus on merging the code with the DotNetNuke branch of GSP. Due to the substantial modifications, this will likely take several weeks and be pretty difficult. But I am committed to making it happen.

Gallery Server Pro Binary Pack Updated

The Gallery Server Pro Binary Pack is a set of open source utilities that add some great features to your gallery:

  • Video and audio encoding to web-optimized formats
  • Thumbnail extraction for video and TXT, PDF, EPS, and PSD (Photoshop) files
  • Metadata extraction for video and audio formats

These components are GhostScript, ImageMagick, and FFmpeg. Today I gathered the latest versions of them and packaged them together into an updated Gallery Server Pro Binary Pack.

Download the Gallery Server Pro Binary Pack.

Progressive loading for MP4

By far the most exciting new feature in this update is FFmpeg’s new support for creating an MP4 that will play in a browser as soon as a few seconds are buffered rather than waiting for the entire video to download. The benefit of this is that now GSP can create standard-compliant MP4 videos that start playing immediately. Because previous versions of FFmpeg forced the browser to download the entire video before beginning playback, GSP defaulted to creating a Flash Video (.flv), which *did* start playing immediately. But that created its own headaches, as the number of devices unable to run Flash have greatly increased over the last couple years.

The next version of GSP will default to creating H.264 MP4 video from most uploaded videos. But you don’t have to wait for 3.0. Install this binary pack into any 2.4 or later version of GSP and then update the Video & Audio page in site admin to include this FFmpeg argument string for MP4 video conversions:

-y -i "{SourceFilePath}" -b 384k -vcodec libx264 -flags +loop+mv4 -cmp 256 -partitions +parti4x4+parti8x8+partp4x4+partp8x8 -subq 6 -trellis 0 -refs 5 -bf 0 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -ac 1 -ar 16000 -r 13 -ab 32000 -movflags +faststart "{DestinationFilePath}"

You will also want to swap the positions of the MP4 and FLV rows so that FLV is *below* MP4, thus giving it a lower priority. The above string is close to what I expect to ship in v3. It has been carefully optimized to create a web-friendly H.264 MP4 video that works well on bandwidth-sensitive mobile devices as well as traditional computers. When you are done it will look like this:

3-14-2013 3-07-47 PM

With this change, all uploaded videos will be converted to MP4 as well as ones you sync when the ‘overwrite optimized’ option is enabled.

Remember that the Binary Pack requires full trust environments. You can tell if your site is running in full trust by looking it up on the Site Settings – General page.

Tuesday, March 5, 2013

Got a Windows tablet?

Update March 11, 2013: I was able to see a Surface for myself at Best Buy a couple days ago and discovered an issue. The album treeview was appearing at the top of the page with the rest of the content below it. This morning I updated the code again, but I still need someone to confirm that it’s fixed. Thanks!

Cut to the chase: I’m looking for someone with a Microsoft tablet (like a Surface) to look at the beta site and tell me whether you see a 3-pane layout like the first screenshot or a single pane like the second. Reply in the comments or send me an e-mail (roger *at* techinfosystems *dot* com). Read on for the full story.

Last week I found myself at a Microsoft store in Minneapolis with the family, so I took the opportunity to see how the beta site looked on a Surface. (Side note: I really should call it a CTP site, since the beta hasn’t yet been released. It’s very close, though.) The styling looked right, the MP4 videos played using the native HTML5 video tag, and the action was smooth and responsive. All great. But there was one problem. I couldn’t use my finger to grab the splitter bars to resize the left and right panes.

gsp_beta_panes

(This screenshot is from my desktop PC, not the Surface, but it looked the same.)

This is actually a problem with every touchscreen device I’ve tried, from Android to iOS to Windows Phone. The splitter is a jQuery plug-in, and it was designed to handle mouse clicks for resizing, not touch events. I’ve looked at the source and tried to make it touch-capable, but haven’t been successful. So, in an effort to stay on track with the release, I made the decision a while back to use javascript to detect a touchscreen and *not* use the splitter on those devices.

Instead of a three-pane view, touchscreen devices show the center pane full screen with the contents of the right pane appearing below the center content. For example, here is how an album looks on a touchscreen that is about 500 pixels wide:

gsp_beta_panes2

That turns out to be pretty much the ideal behavior you would want on small touchscreens, since they don’t have sufficient width to justify panes anyway. But larger 10-inch tablets could benefit from the pane layout so the ultimate goal is still to make the splitter bar touch-capable so I can re-enable it on large tablets. But this will probably be after the v3 release.

Getting back to the Surface, I noticed that it was displaying the 3-pane layout just like a desktop browser. Something was wrong with my touchscreen detection javascript. After a little googling with bing, I learned it is very difficult to reliably detect a touch device. I had assumed that using Modernizr.touch would be fine, but IE10 returns false, even when run on a tablet.

After digging around, I found a different technique that supposedly works on MS tablets:

var isTouchScreen = !!('ontouchstart' in window) || !!navigator.msMaxTouchPoints;


I updated the beta site to use this code and confirmed it works as expected on the devices I have laying around, but I don’t have a MS tablet to test it on. So I ask you, Dear Reader, if you have a Microsoft tablet like a Surface, can you go to the beta site and tell me whether you see a 3-pane layout like the first screenshot or a single pane like the second. Thanks!

Friday, January 4, 2013

Need an iOS device for testing

I want the upcoming release of Gallery Server Pro 3.0 to work great on all devices, whether it be a smart phone, a tablet, or a 27-inch monitor. Touch screen devices are especially important to test, since the primary interaction is through touch rather than a keyboard and mouse. To this end, I need to perform real-world testing on each major type of device. I have a Google Nexus 7 and my wife has a Windows Phone, so I have the Android and Microsoft worlds covered at a basic level.

The glaring omission in my testing equipment is on the Apple side, especially their touch screen devices iPod, iPhone, and iPad. And so I humbly reach out to you to ask for your help. Are you able to donate an iOS device to the cause? Any device is better than nothing, but my preference is for a 10-inch iPad, since that may be the more common use case and my other devices are 3 1/2 inches and 7 inches, so I don’t have the 10-inch size covered.

Gallery Server Pro is free software released under the GPL, so I hope to find a kind soul who can return the favor and keep the Karma flowing. Perhaps you have a first generation iPad that is not getting much use. Or maybe you want to guarantee that GSP looks great on the new iPad with Retina display. Whatever the reason, your donation helps prove that open source works and will contribute to the long-term success of this project.

My address is in the footer of every page on www.galleryserverpro.com. As always, I thank you for your support!

Friday, December 21, 2012

Public Preview of Gallery Server Pro 3.0

Christmas is the time for giving, so today I give you hands-on ability to play with Gallery Server Pro 3.0. Go to beta.galleryserverpro.com and poke around. You can log in to add, edit or delete items in the album named Public Playground (use account Demo with password demo). The major new features include:

  • UI completely rewritten using modern HTML5/CSS3
  • Skinned user interface
  • Tagging and editable metadata
  • Template-based rendering
  • User ratings of media objects
  • Full screen slide show
  • Flexible sorting
  • Adaptive rendering on mobile devices
  • Video and audio rendering improvements
  • ComponentArt controls replaced with jQuery widgets
  • Remove dependence on MS Ajax library and ScriptManager

Some of these features were discussed in this blog post, so you may want to check that out as well.

The code is not yet at beta status, so for now the website is the only place where you can play with the new version. I will be releasing a beta as soon as I can – hopefully within a few months, but external forces (like client contracts) may delay that.

A beautiful user interface

ss1

Take a look at the gorgeous new design. The default skin is light text on a dark background. This switch was inspired by user feedback where I learned that images are best viewed against an 18% neutral gray background. The background color I chose ended up a little darker than this to enhance the contrast against the text. A light skin is also available for those of you wanting the more traditional dark text on light background.

The icons are modern, monochromatic, and match the trend we see with other applications and operating systems.

The window is divided into three panes. Each pane is resizable and can be docked. Their availability and default visibility can be controlled by the administrator. By default, an album treeview appears in the left pane, the thumbnails or media object is in the middle, and details about the selected items are in the right pane. The contents of each pane are customizable by editing it’s template in the site admin area. Read more about the template feature in the other blog post.

Clicking the thumbnail image takes you to a web-optimized version of the image:

ss2

The toolbar above the image has less buttons than previous versions while providing more functionality. For example, the functionality of the two download buttons in the current version has been merged into the share button:

ss5

A new feature is the ability to get an URL directly to the media file rather than the web page. Right-click the Download file link to grab an URL you can copy into Facebook or any other place.

Information about the image is displayed in the right pane. When you are logged in with an account with edit permission, you can edit a property by clicking on it and typing. Then tab out to save the change. No need to go to a separate edit page.

ss3

A really handy feature is the ability to edit multiple items at once. On the thumbnail view, use the mouse to drag select the desired thumbnails or CTRL-click individual items, then edit the property the same way as described above. This is an easy way to edit hundreds of items at once.

You may not want certain properties to be editable. You have full control over which ones can be changed and how they are created. The metadata page in the site admin area has been overhauled to provide fine-grained control:

ss4

You can change the sort order, display name, whether it applies to albums or media objects, and whether a user can edit it.

Custom properties can be created as well. At the bottom of the default metadata list seen above is a set of twenty custom properties you can use for any purpose. For example, let’s say I have a gallery of items where I want to specify a color. An admin goes to the metadata page in the site admin area and specifies the new property. Here I name it Color, set the default value to Black, apply it to media objects (not albums), and make it editable to anyone with edit permission. Then I click Rebuild to have the custom property created for all my gallery items.

ss6

When the rebuild is finished, I see the property on all my media objects. If I wanted it to appear higher in the list, I can drag that property to the desired location in the admin settings.

ss7

Tagging and template rendering

I covered these topics pretty well in this blog post, so I refer you there.

User ratings

An often requested feature is the ability to rate items. That has now been implemented as one of the properties in the right pane. The default value for ratings is imported from the rating metadata in the file, if it exists. By default all users – even anonymous ones - can rate an item, but this can be adjusted in the admin settings.

ss8

Once you rate an item, the label changes to indicate it now shows your rating. The rating algorithm is smart enough to prevent multiple ratings by the same person from unfairly influencing the value. Items in an album can be sorted by rating so that the highest rated items are always shown first.

ss9

Full screen slide show

I have wanted to improve the slide show mechanism for a long time. I evaluated several jQuery plug-ins and finally found one that had almost all the features I wanted – supersized. Thanks to the beauty of open source, I forked the project on GitHub and made the necessary tweaks to make it work the way I dreamed a slide show should.

ss10

When you start a slide show, the image is shown as large as possible to take advantage of the available screen real estate. A thumbnail bar gives you a quick glance at all the images and offers an easy way to navigate to them. The title appears at the bottom, and you can exit with the X button.

Note that this is not a true full-screen slide show, since the browser frame is still visible. I have gone back and forth over whether I would want it truly full screen (and there are good reasons not to), but in the end I just used the default behavior of the plug-in. You can easily make it truly full-screen by making your browser full screen, usually by hitting F11.

Flexible sorting

The sorting function has been overhauled and vastly improved. You can now sort by any metadata tag in ascending or descending order. To prevent overwhelming the user, a default gallery lets you choose from five properties.

ss11

When anonymous users or logged on users with view-only permission sort an album, it applies only to them. This preference is stored in session for anonymous users and in the user’s profile for logged on users. When an editor changes a sort, they are applying the new sort to all future users.

To change which properties are available to the user for sorting, edit the album template. For example, to allow sorting by Author, go to the Templates page in the site admin area and select the album template and look for the section where the sort options are defined. Then add a row for the Author:

ss12

Notice that we specify data-id=’2’. That number identifies the Author metadata item and can be found on the Metadata screen in the site admin area. Refer to the earlier screen shot of that page to see what I mean. We also hard code the text ‘Author’ rather than specify a variable like the others. After saving the changes, we can now sort by Author:

ss13

You may be wondering about the resource references you see in the template, like {{:Resource:AbmSortByFileName}}. That is a language-agnostic way to specify the text.For example, if the French resource file is installed in the App_GlobalResources directory, users whose browser is set to French will receive the French equivalent of ‘Filename’. You are not required to follow this convention when editing the template. As you might imagine, it is easier to hard code the text than map it to a resource. Those of you who do want to map it to a resource may need to modify the source code to include any resources that aren’t included by default.

Smart phone and tablet support

A goal of version 3 was to make Gallery Server Pro work great on all devices, from a 320 pixel wide smart phone to an iPad to a traditional desktop. To that end, the new version makes use of CSS media queries and other techniques to provide for adaptive rendering on small screens. For example, the gallery automatically hides the treeview when there isn’t enough room on the screen. And the metadata is shown *below* the center pane rather than to the right of it.

I still have some work to go in this area. For example, the grab handles for the splitter bars aren’t clickable on the touch screens I’ve tested. I expect to have these issues resolved for the final release.

What about comments?

The ability to comment on items was a goal for version 3, but for a few reasons I am not including it in this version. The primary reason is time – I already blew my self-imposed deadline of December 2012 for the release, and adding a comment engine would postpone the release by a few weeks.

A second reason is that you can easily plug in a comment engine on your own. For example, you can add the Facebook comment widget by tweaking the template. This blog post described how to hack the the current version of Gallery Server Pro to include the widget. Now that we have templates it will be easier and without the drawbacks of the original approach.

I am still open to adding native comments in a future version. Your feedback will drive whether this is important.

Current status

Most of the browsing and editing functionality is finished, although there are undoubtedly bugs to be squashed. Please report any issues you find.

Most of the remaining work involves the admin pages where I need to replace the remaining ComponentArt controls with HTML equivalents and MS Ajax/ScriptManager with jQuery. I also want to build admin pages for the browser templates and CSS files, but I that may be cut if necessary.

I plan to release a feature-complete beta in the first half of 2013, with the exception of support for upgrades from previous versions. While you guys are hammering on the beta I can work on the upgrade stuff. There is a lot of work to do in this area because version 3 uses Entity Framework Code First Database Migrations, which will ultimately make future upgrades simpler and dramatically reduce the amount of work I have to do to support two database technologies (SQL Server and SQL Server CE). But to get there the upgrade needs to create new tables and migrate data from the old tables.