1 (edited by DX2300 2020-01-12 16:45:15)

Topic: Cleaning Up config.xml

If you have a gallery that you've played with for a while, changing settings back and forth, this might interest you.

Start JuiceboxBuilder (JbB) - New Gallery. Then import a few images, and make no further changes. Go directly to Publish, and do so.

It's interesting to see what JbB creates on it's own. Here's the settings section of config.xml:

    imageQuality="99"
    thumbQuality="99"
    useLargeImages="true"
    largeImageQuality="99"
    useSmallImages="true"
    smallImageQuality="99"

None of which are in the Config Guide.¹  https://www.juicebox.net/support/config_options/
The interesting ones (for now) shown below, the rest of the options set maximum image quality.

    useLargeImages="true"
    useSmallImages="true"

This creates three sets of images for the gallery, Small, reg, large. Small screen mode for phones and smaller tablets. And images 1024x768 pixels or bigger for larger screen devices.

Now lets change something in JbB and see what happens to config.xml.

Side Note: config.xml and index.html are really a pair of files to be considered together. JbB changes both files depending on settings selected.

In JbB,  lets change the 'show open button' setting in the Lite Section. Then re-read config.xml:

    imageQuality="99"
    thumbQuality="99"
    useLargeImages="true"
    largeImageQuality="99"
    useSmallImages="true"
    smallImageQuality="99"
    showOpenButton="false"

The new settings are added to the bottom on config.xml.
Now we're getting to the point of this post.
Let's reset 'show open button' back to the original setting, using JbB. And re-read config.xml:

    imageQuality="99"
    thumbQuality="99"
    useLargeImages="true"
    largeImageQuality="99"
    useSmallImages="true"
    smallImageQuality="99"
    showOpenButton="true"

Now, there will always be a setting for 'show open button' in your config.xml.
If you've enjoyed playing with the many options in JuiceboxBuilder, you config.xml could be quite large. I don't know what performance that might make on slower, low powered devices. It just makes sense the leaner config.xml is the better.

And if you're like me and it doesn't take much of a reason to go mucking about with things, here we go.

Continued in Part Two.

DX2300

¹ as worded in config.xml. The are options to include or not, the small and large images in JbB.

2 (edited by DX2300 2020-01-12 21:28:16)

Re: Cleaning Up config.xml

Part Two


Let's look up:

showOpenButton

in  https://www.juicebox.net/support/config_options/.

With your browser at the config options page, enter control-F, for Find. Search for 'showOpenButton'.
This is how to find the settings from your config.xml and check for the default value.

The default value/action for  'showOpenButton' is "true". This is what will happen if it's not listed in config.xml. The defaults don't need to be declared and can be purged from config.xml.

Also, the order of declarations in config.xml is not Important. I've rearranged one of mine, by grouping related items together, and then copy/pasting it to every gallery in that section, making the changes universal.

As a general rule, I would suggest opening the modified gallery with JbB and re-publishing. Use that config.xml as the template for cloning your galleries.


DX2300

P.S. Remember, whatever happens to your galleries, you did it.  :-)
P.P.S. Information is offered is the best of my understanding.

Re: Cleaning Up config.xml

Just a couple of quick clarifications and expanded explanations:

None of which are in the Config Guide.

All the configuration options which are used by Juicebox when the gallery is displayed in a browser (i.e. those options which make a difference to the layout and functionality of a gallery) are included in the Config Options page.
JuiceboxBuilder-Pro does write some extra settings to the gallery's 'config.xml' file which are not included in the Config Options page.
These settings mostly refer to image generation and are included so that if the gallery is opened and edited by JuiceboxBuilder-Pro in the future, the same image settings (e.g. dimensions and quality) will be used.

Side Note: config.xml and index.html are really a pair of files to be considered together. JbB changes both files depending on settings selected.

All configuration options (required by both Juicebox and JuiceboxBuilder-Pro) and image data are stored in the gallery's 'config.xml' file.
The 'index.html' file contains just the gallery's embedding code and the SEO Content (if the 'Add SEO Content' checkbox is selected in JuiceboxBuilder-Pro's 'Customize -> Sharing' section).
The SEO Content contains the image paths, titles and captions.
The only configuration options that are stored in the embedding code are the Embed Options, backgroundColor, galleryWidth and galleryHeight.
JuiceboxBuilder-Pro writes values for these options to the 'config.xml' file (again options which are not used by Juicebox when the gallery is displayed) so that the application's interface can be populated with the correct values when the gallery is opened for editing.
(JuiceboxBuilder-Pro reads only the gallery's 'config.xml' file (and not the 'index.html' file) on opening a gallery so all data required to recreate a gallery is stored in the 'config.xml' file.)

Now, there will always be a setting for 'show open button' in your config.xml.

As you correctly mention, default values do not need to be written to the 'config.xml' file.
If a particular configuration option is not present in the 'config.xml' file, then Juicebox will use the option's default value.
If you reset an option to its default value using its own input field (e.g. checkbox or combobox), then the option will remain in the 'config.xml' file (with the correct default value).
However, if you reset an option's value using the 'cross-in-a-circle' icon to the right of the option (in JuiceboxBuilder-Pro's interface), then the option will be removed from the 'config.xml' file.
Essentially, if a value is set by the user (even to a default value), then the option will be present in the 'config.xml' file.

I don't know what performance that might make on slower, low powered devices.

Having all configuration options listed in a 'config.xml' file really won't make any noticeable difference in a real-world scenario and is nothing to worry about.