Wednesday, July 12, 2006

Export XML from Bridge for Spry Gallery II

I updated the script so it exports an XML file from Bridge with full compatibility with the Spry Demo Photo Gallery, to use as photos.xml. See this post to learn more about the script.

It's at the same address, download here.

To Use:

The script goes in the folder "StartupScripts" in Program Files/Common Files/Adobe.

Launch Bridge and browse to a folder that contains the files you want in your gallery -- the "source" folder, as it were.

Choose the menu command "Tools > Export XML for Spry Gallery".

Type a name for your XML file in the Save dialog box, choose a location, and hit "Save".

In the dialog box that pops up, enter a max length/width for your thumbnails, in pixels. Some common sizes are "75" , "100" or "125".

Hit "OK". You should see an alert pop up telling you "XML file successfully created!"

Note: The same caveats about not using CDATA in your "Title"/caption field still holds -- haven't expanded the script to take care of that yet.

Wednesday, July 05, 2006

Generate Photo Gallery XML for Spry with Adobe Bridge

I've discovered/worked out a way to generate a very useful photos.xml from Adobe Bridge. If you use Bridge, it's very easy to add titles, keywords, ratings -- all kinds of metadata that one might use in a photo gallery.

The script is based on one I found at the Adobe User to User Bridge Scripting Forum for exporting a CSV file. Link to forum thread (this also shows most of the other metadata you can grab and how to get it into JS).

Note 1: this particular script doesn't take into account CDATA that might exist in your metadata, like ampersands in your title. Thus far, I've just avoided using those, but one could also have the script write out a CDATA node for that info instead.

Note 2: this script does not write out a thumbpath, thumbwidth or thumbheight attribute. But usually the thumbpath is the exact same as the regular "path" attribute, and the thumbwidth and thumbheight are just a ratio of the regular "width" and "height" attributes. I added a bit of JS to the gallery.js file to calculate those before growing the thumbnail on rollover.

if (lgWidth > lgHeight)
{ width = gThumbLargestSide;
height = (gThumbLargestSide * lgHeight)/lgWidth;}
else
{ height = gThumbLargestSide;
width = (gThumbLargestSide * lgWidth)/lgHeight;};

Right now I'm using keywords as categories and titles as captions and sorting by rating (stars in Bridge), so here's the .jsx file I created. The script should be saved to the folder "StartupScripts" in Program Files/Common Files/Adobe. It's then run by launching Bridge, browsing to the folder that holds your photo gallery large image files, and choosing Tools>Export XML File from the top menu.

Download a zip with the .jsx file.

I made some changes to the script so it now generates thumbnail info, and other clean-ups. See the related post, here.