banner
Advertising


Lightroom-News.com
LRN Contents
Calendar
LRN Archives
Meta
RSS Feeds


Lightroom-News.com

The lastest news and info about Adobe Photoshop Lightroom


August 29, 2008

Creating a Lightroom Gallery Part 2: The GalleryInfo.lrweb File

This is the second post in an ongoing series where I take you through the creation of a basic web gallery in Lightroom.

As mentioned in the opening post, galleryInfo.lrweb is the heart of the gallery. It’s what gives us the look of the panels and the controls that are accessed by our HTML file. For my editing I use TextWrangler or Taco HTML Edit, depending on whether I’m looking at code, or copying and pasting between files. TextWrangler has coloured highlighting for Lua code, which is very handy. Of course any text editor will do. So let’s start from scratch with a superbly basic file.

return {
	LrSdkVersion = 2.0,                                                           
	LrSdkMinimumVersion = 2.0,    

	version = 1.0,
	title = "basic",
	id = "com.seanmcfoto.basic",
	galleryType = "lua",
	maximumGallerySize = 50,

	model = {
		["photoSizes.photo.height"] = 500,
		["photoSizes.photo.width"] = 500,
	},
}

This is pretty much the minimum the file can contain. Files with the extension .lrweb are actually Lua files. In such files, the code is contained inside a return {} statement. Let’s look at the code we have there in detail.

The first 2 lines of code inside are:

	LrSdkVersion = 2.0,                                                           
	LrSdkMinimumVersion = 2.0, 

The first line tells Lightroom what SDK version we are using. Although we have specified V2.0 here, it also reads older V1.3 Lua code. I recommend writing with the new syntax (i.e. the new form of the code) though. The second line tells Lightroom that we need to have Lightroom 2.0 for this gallery to work. The equals here mens that the value 2.0 is being assigned. Notice that each line ends in a comma. This is vital for most lines of code, as the semicolon is in most coding languages. Too many or too few commas will simply break the gallery, and when you’ve 2,000 lines of code, it can be hard to find!

The next section defines the gallery itself. Version tells us the gallery version number. Title is the text that appears in the Engine panel on the top of the Right panel in Lightroom (fig. 1). Note that when you name a gallery, it sorts capitals before lowercase.

engine.jpg
Fig 1
	version = 1.0,
	title = "basic",
	id = "com.seanmcfoto.basic",

The next definition is “id”. This is the internal name used for the gallery by Lightroom. When you create a Web Template, Lightroom uses the id to link it to the gallery. Normally this takes the form of a backwards web address: com.domain.galleryname. Each gallery you create (or use) should have a unique title and id. If you have 2 galleries with the same id, one of them will be ignored. Having a different title means it’s easier to pick from the Engine list. The title can be added to the localisation list, but that’s something for a different post.

Next up is galleryType. There are 2 types: Lua and Flash. We’re only dealing with HTML galleries here, so we choose lua. Finally in this section we have maximumGallerySize, which limits the number of images in the gallery.

	model = {
		["photoSizes.photo.height"] = 500,
		["photoSizes.photo.width"] = 500,
	},

The next section up is the “model” section. Here we define the attributes of the images and other gallery items. As this is very basic, we’ve only defined the size of our photo. Using photoSizes, we define an image rendition type (photo) and assign it a width (photoSizes.photo.width) and a height (photoSizes.photo.height). You could use large, or big or any other name instead of photo, as long as you call it that throughout the gallery. Later on, we’ll create sliders that let us change these settings in the gallery.

So far we’ve only created one file, we’ll need to create both a manifest.lrweb file and our HTML file to have something we can actually preview in Lightroom. And that’ll have to wait for the next post.

Leave a Reply

You must be logged in to post a comment.