Topic: Juicebox & File Directories for Images

Hello all,

A friend is currently helping me develop a Drupal 8 site.  One of the features I need is to have the ability to embed galleries into a page.  He was able to set up Juicebox to embed a gallery at the bottom of a page, but there is one issue that we are unsure how to solve:

When I am creating a page, I use the "Insert Lightbox Gallery" section at the bottom of the form to add images.  However, all the images appear to go into the same directory.  I do not have the option of organizing my photos and placing them in separate galleries (ex: a folder for graduation, another for wedding).

Does anyone know of a way to do this in either version of Juicebox?  I really appreciate any helpful feedback.  Thank you.


Re: Juicebox & File Directories for Images

This seems like a Drupal-specific gallery structure type of issue (i.e. a problem building the gallery within Drupal rather than a problem with Juicebox itself).

I'm not sure if you are using the Juicebox Module for Drupal but it sounds like you might be.
I don't know you are building your Juicebox gallery or how you'd get the paths of the images from your Lightbox Gallery into your Juicebox gallery's 'config.xml' file.

As the Juicebox Module for Drupal is an unofficial plugin which was not written by ourselves, I would recommend that you post your query in the Drupal forum where the author of the module (Ryan Jacobs) should hopefully be able to help you further.
He is active and very helpful in the Drupal forum and has a much better knowledge that I have of both the module and Drupal.

An alternative to using the module would be to create a gallery first on your computer using JuiceboxBuilder-Lite and then embed the gallery into your Drupal page using the baseUrl method of embedding following the Embedding in a Drupal Site instructions.
In doing so, you would be able to keep each gallery in its own self-contained folder (helping to keep things organized on your web server).

Here's an example of how to embed a gallery (created with JuiceboxBuilder-Liteon your computer) manually into a Drupal page.

Step #1
Create your gallery with JuiceboxBuilder-Lite and save it to a new empty folder named "my_gallery_folder".

Upload the entire gallery folder (not just the contents) to the root directory of your web server (using an FTP program such as Filezilla).

Step #3
Create a new Article, select 'Full HTML' from the 'Text Format' drop-down menu and paste the following embedding code (changing the gallery dimensions and background color if you like):

<script src="/my_gallery_folder/jbcore/juicebox.js"></script>
    new juicebox({
        baseUrl: "/my_gallery_folder/",
        containerId: "juicebox-container",
        galleryWidth: "100%",
        galleryHeight: "600",
        backgroundColor: "#222222"
<div id="juicebox-container"></div>

The leading slashes in the paths above denote your root directory so the code above will work without modification as long as your gallery folder is named "my_gallery_folder" and has been uploaded to your root directory.

Incidentally, you can upload your gallery folder to anywhere on your web server as long as the two paths within the embedding code (the path to the 'juicebox.js' file and the baseUrl entry itself, pointing towards the gallery folder) are correct.

I hope this helps (or at least points you in the right direction).

Re: Juicebox & File Directories for Images

Thank you Steven!  That helps and gives me some leads.  I really appreciate the quick reply. :)


Re: Juicebox & File Directories for Images

You're welcome!
I hope you get on OK.