Topic: Caching Problem

Hi,

I make juicebox galleries with images to show editing progress to my customer. So, from time to time i overwrite the existing gallery with a new one, exported from lightroom.

My problem is that the images are cached, an my client never sees the new ones, except if he clears the browser cache before.

caching of the config.xml could be circumvented if i add a random query to the image url, like

new juicebox({
                containerid : 'juicebox-container'
                , configUrl :'config.xml?' + (new Date()).getTime()                
            });

which is fine, as the config.xml is a small file ...

in the same manner, the caching of the image could be circumvented if i add a random query to the image url, like "http://url/image.jpg?12345679" (in the lightroom template config.xml). But this will load the image every time which is a bit much for the size of the images ...

Is there a Lightroom variable from the photo in the style of "getImage(index).metadata.caption" which i can use to form a "image version", to prevent caching? like the field "date of metadata". Or an export wide time stamp would also work.

Any ideas, how this could be done?

Thanks in advance,

Fabian

Re: Caching Problem

Perhaps you could incorporate the version number into the image name itself, e.g. image001_v2.jpg.
If the browser sees a new image name, then it will have no option but to fetch it from the server.

Re: Caching Problem

Steven,

Thanks for your support, I appreciate your help!

It could be done that way. If you have virtual copies, you could do a F2 rename extending the orignal filename with a version before each export.

I came up with the following solution/hack.

The config.xml template in the plugin package:

<image imageURL="images/<%= getImage(index).exportFilename %>.jpg?<%= getImage(index).metadata.title %>"
    thumbURL="thumbnails/<%= getImage(index).exportFilename %>.jpg?<%= getImage(index).metadata.title %>"
    linkURL="images/<%= getImage(index).exportFilename %>.jpg?<%= getImage(index).metadata.title %>"
    linkTarget="_blank">
        <caption><![CDATA[<%= getImage(index).metadata.caption %>]]></caption>
  </image>

I reused the "Title" attribute of the plugin, set it to contain userdefined text. In this text I will increment the version number before each export. "2012091801" in the following example.  The resulting config.xml look like that:

...

  <image imageURL="images/2012081700_0449.jpg?2012091801"
    thumbURL="thumbnails/2012081700_0449.jpg?2012091801"
    linkURL="images/2012081700_0449.jpg?2012091801"
    linkTarget="_blank">
        <caption><![CDATA[2012081700_0449 – Grün]]></caption>
  </image>
    

  <image imageURL="images/2012081700_0471.jpg?2012091801"
    thumbURL="thumbnails/2012081700_0471.jpg?2012091801"
    linkURL="images/2012081700_0471.jpg?2012091801"
    linkTarget="_blank">
        <caption><![CDATA[2012081700_0471 – ]]></caption>
  </image>

...

The caching problem was solved with this hack.

is there a chance that such a field will be included in future version of the plugin, or could that be done by myself?

Many thanks,

Fabian

Re: Caching Problem

I think it is unlikely that such functionality will be included in a future version of the plugin.
Although the full source code for the plugin is not available, you are free to modify the downloadable files as you wish.