Skip to main content
Blatman888
Participating Frequently
September 18, 2008
Question

Accessing custom metadata from Web Engine gallery

  • September 18, 2008
  • 16 replies
  • 4950 views
Hi folks - using LR 2.0 and slogging through the SDK and Web Engine stuff.
Basically, can custom metadata fields from a plugin be accessed from a Web Engine at all and if so how?

I have managed to create a custom metadata field (I don't really want to use one of the inbuilt dedicated metadata fields) in the Library module and it works fine, I can add notes to each image and the info is kept in the Catalog not in the XMP or with image (SDK says this) however I wish to access this field from the Web Gallery via the galleryInfo.lrweb file but not sure how or if it can be done.

My custom plugin name is "nz.org.wh.metadata.photogallerynotes" and the field id (set in metadataFieldsForPhotos = { part of plugin ) is "notes".
I tried using the perImageSettings parameter with "nz.org.wh.metadata.photogallerynotes.notes" as a value but no good - I think maybe that the perImageSetting parameter can only be used with "com.adobe" type fields such as title, caption, etc. Maybe I am asking for a LR 3.0 DCR ... :-)

Cheers.
This topic has been closed for replies.

16 replies

john beardsworth
Community Expert
Community Expert
October 11, 2008
I think you have a good point in there, Blane. It's no good Adobe letting us add custom fields if we can't do much with them, whether it's displaying them in Web, Print, or saving the information to the image sidecar or embedded metadata.
Blatman888
Participating Frequently
October 10, 2008
Yes, I had a quick glance at the custom tags stuff a while ago but moved away from it since the custom tags will be OK in LR as XML but I want to keep standard HTML tags on the web pages. Essentially what I am doing is creating an XHTML 1.0 web page and through the use of CSS and Javascript it will show a bunch of scrollable thumbs (in a grid page) which will if clicked open a large image in another box (with Thickbox optional) . Info such as caption, exif/iptc ( & notes ) is presented on the page in different formats. This essentially is a personal photo album which can be used on a local web or even CHM'd. I'm moving a pre-populated XHTML web page into LR so I can develop a Web Engine that will allow CSS tuning and image/metadata generation on the page so any info entered in the library module against an image will be available in the Web Gallery and be written to the HTML via the galleryInfo.lrweb file. Currently the original XHTML page contains metadata in SPAN tags with ID's attached so LR can populate these easily (except custom notes at this stage). The other possibility I was thinking of was trying to get the custom notes written out to an XML file which can then be DOM parsed by Javascript back into the XHTML - however it would be nice to keep as much of the 'machinery' inside LR. Extending the perImageSettings to encompass custom metadata rather than just adobe.com metadata would do the trick obviously .... Adobe listening????? The end result for quite a large album will be an XHTML page full of grid frames with associated span tags containing attached metadata that can be presented via CSS/JS. Bandwidth is no issue being a local photo album (just like the ol' paper ones!).
Participating Frequently
October 10, 2008
I'm just learning the web engine side of things myself, and now I think I am beginning to understand better what it is you need.

I just realized (and verified) that I can define custom tags to get at custom metadata for display with each photo in the grid view (and presumably other views as well). In the definition of the custom tags, you have the opportunity to write LUA functions which dig into the custom metadata using LrPhoto:getPropertyForPlugin, LrCatalog:findPhotosWithProperty, etc. Custom tags are described in the SDK guide.
Blatman888
Participating Frequently
October 9, 2008
Looks interesting Chet - using the lua search methods. However wasn't aware that a button with an action could be used in the Web engine UI Panels ( not really mentioned in SDK). Maybe a binding would be possible with a nonCSS parameter in the galleryInfo.lrweb file and therefore allow the notes metadata for each image to be inserted into the HTML.
Alternatively I was thinking that if the notes metadata could somehow be inserted (and be selectable) into the Text Template Editor that is used from the UI panels then that may provide a key.
Cheers.
Participating Frequently
October 8, 2008
I would have responded sooner, but I just learned this myself (you may have figured it out yourself already). You should be able to do something like this in your web engine gallery:

local catalog = import'LrApplication'.activeCatalog()

catalog:withWriteAccessDo('some_string', function()

local photos = catalog:findPhotosWithProperty('nz.org.wh.metadata.photogallerynotes', 'notes')

for i, v in ipairs(photos) do
-- whatever it is you want to do with these photos...
end
end)

In my own experiment, this code appears inside the 'action' function for a button which appears in a panel for my web engine gallery, and the property was written by a plug-in appearing as a 'plug-in extra'.

The above code assumes, of course, that the 'notes' property was successfully written at some point in the past by the plugin identified by 'nz.org.wh.metadata.photogallerynotes'

Hope this helps.
Sean McCormack
Community Expert
Community Expert
September 20, 2008
I've been thinking about that myself. Let me know if you find anything ;)
Sean McCormack. Author of 'Essential Development 3'. Magazine Writer. Former Official Fuji X-Photographer.