Photoshop Lightroom Flash Gallery Tips and Tricks #3: Embedding a Flash gallery into a web page at a fixed size

When you export a Flash Gallery out of Photoshop Lightroom 1.0, it makes a web page for you (index.html) and on that page the gallery always scales to fit the browser window.  That’s nice, but sometimes you want to put a gallery into your own web page with other content.  If you do that, you may want to turn off the Header bar and Menu bar in the gallery itself (covered in Tips and tricks #2). 

You may also want to “fix” the size of the gallery so that it does not auto-scale to fit the available space.

One reason that you’d want to prevent your gallery from scaling is if you put a photographic image into the background of your gallery (discussed in tips and tricks #1).  Otherwise, the background image will “stretch” - non-proportionally - to fit the entire browser window (not so nice when that image is a “photo”). 

The  “index.html” file that Lightroom generates is fairly complex, with lots of JavaScript, etc.  I’m not going to go into depth on that topic here (maybe in a future article) but rather give you a couple tips:

  1. You can “fix” the size of the gallery in the “index.hml” page by changing just two numbers.  First find this bit of text in the source HTML:
  2. else if (hasReqestedVersion) {  // if we've detected an acceptable version
        AC_FL_RunContent(

  3.  Now a couple lines below that you’ll see width and height parameters that are set to “100%”.  Just change those to pixel values (for example: 'width', '650',)

Note that about 650 pixels is the minimum width that you can make the gallery without it being “cropped”. That said, the source code of the Flash Gallery found in Photoshop Elements 5.0 (of which the one in Lightroom is a variant) has been open-sourced at http://opensource.adobe.com/amg/.  So, someone ;) could make a version of the gallery swf that does not have this limitation. …

This is all great, but how do you do this in an existing web page with other kinds of content?  Well, as mentioned, the scripts found in the index.html file are pretty complex (for non-coders that is) but there is a fairly simple solution that suffices in many cases. If you put your own html page right next to the exported gallery’s “index.html” file (for example in the root folder of an exported gallery) you can use simple Flash embed code within your own html page.  There are many variants of this but here’s an example using 650x400 as the dimensions:

<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs
/flash/swflash.cab#version=7,0,19,0" width="650" height="400">

  <param name="movie" value="resources/gallery.swf" />

  <param name="quality" value="high" />

<embed
src="resources/gallery.swf"
quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash"
width="650" height="400">
</embed>

One of the neat tricks that you can do with this is use a background image that is specifically designed to fit exactly behind your gallery.  This would allow you to do things like; put a flat “fill” behind captions if you have them, or put a texture in just the Header bar, have a photo of a TV screen as a “frame” for your photos, etc.  It takes a bit of fidgeting around with things to get this just right.

 If you want to play with this, you might want to export a gallery, open the index.html file and set your fixed size (as described above), preview it in your browser, take a screen capture, and use this as a reference layer in Photoshop while editing your background image.  In the case where you are using the background as a “frame” for your photos, it works best if you use the “slideshow only” layout gallery template (via the layout menu in the “appearance” panel inside Lightroom).  Otherwise, the position of the images will change when the user switches between “gallery view” (with thumbnails showing) and “slideshow view” (with no thumbnails).