October 19, 2008
In our previous installment we discussed adding Styles to our gallery, but discovered that we needed to restart Lightroom to see the changes. Now we look at automatic refreshing in Lightroom.
To add live update to our gallery we need to get the file first. You can get this file from the Lightroom SDK, the default html gallery, or even from 3rd party galleries like my own or from The Turning Gate.
In the resources folder we created already, add a folder called ‘js’, then add the file live_update.js to it.
Open the HTML and under the css link, add the following following:
The window.AgMode lets Lightroom know when it needs to use Live Update.
Save the HTML file and restart Lightroom. Click on the colour chip to active the color picker. The background colour should now change as you move around the colour picker.
In the background Live Update reads the information you are changing and decides what kind of refresh is needed. If the settings affect the current page, it will be refreshed. If they affect the CSS file, then everything except the generated Jpeg files are refreshed. Changing an image size will refresh the images, as will watermarking, sharpening and quality changes. There’s also a case for an exception forcing the gallery to reload.
You can add cases to the live_update file for specific settings if you want. It’s beyond the scope of this series, but well covered in the SDK.