Drupal 7,7.x-1.0-beta1 module on local host

Read the instructions and documentations and went through all of the steps repeatedly but the images won't appear in the gallery after i save the content. I'm using node display as i don't want each image to be a separate node.

I created the content type and changed the display format to juicebox gallery. Uploaded a few pictures and saved but all i get is a grey background with a juicebox logo rotating at the center. The pics are not getting loaded on to the gallery.

I was looking for a gallery module and this one just seems perfect. It would be great if i could get it to work.

Comments

abhishek.r’s picture

I found out that the problem exists only for a logged in user. For an anonymous user the gallery works fine. Also i was using firefox browser all this time. I tried it using chrome and it gave the following error :

"Juicebox Error: Config XML file not found."

rjacobs’s picture

Category: bug » support

Hi abhishek.r

If marking as a bug just be sure that you are using the latest available version of the module. You said you have 7.x-1.0-beta1 so you should first update to 7.x-1.0-beta2, clear your caches, and test once again. This will allow us to confirm if this issue can be replicated with the most recent copy of the code.

If the problem persists after the update, my next troubleshooting recommendation would be to temporarily change both the "Main Image Style" and "Thumbnail Style" settings to "None (Original Image)", clear caches once again, and see if the gallery displays correctly after that (for both anonymous and logged-in users). This will bypass all image style mechanisms (that do resizing to the image data Juicebox uses) and tell us if that could be related to the problem you are having.

Please let me know if anything changes after these steps, as this will will help narrow things down quite a bit.

Also, what version of the Libraries API module you are using (check at /admin/modules) and what version of the Juicebox javascript library do you have (check at /admin/reports/status)? A couple users indicated that outdated versions of either of these can lead to some issues. I'd be interested to know if that could be a factor in your case as well.

Just let me know and we can go from there.

abhishek.r’s picture

Version: 7.x-1.0-beta1 » 7.x-1.0-beta2

I was in fact using the 7.x-1.0-beta2 version. That was my mistake. I'm really sorry for that.

I changed both the "main image style" and the "thumbnail image style" to "none" as you had instructed, cleared the caches and checked. It hasn't changed anything. It still works for anonymous users but doesn't display the images for a logged-in user.

I'm using the libraries API version 7.x-2.1 module and i have the latest juicebox lite 1.2.0 js library.

abhishek.r’s picture

I just found out that the problem exists only for the superuser. The gallery works fine for a normal authenticated user too.

rjacobs’s picture

Hummm, that's quite strange. I'm currently not able to replicate this problem on my end using those same versions, so perhaps there is something unique about your particular setup.

It sounds like there may be some issues accessing the XML that describes the gallery (what juicebox refers to as the "config.xml"). This may be because there is a problem when the XML is actually rendered or because there is a simple issue with structure of the URL that points to the XML. My suggestion is to have a look at the embed code itself (within the page that the Gallery should appear on, but does not) and see what the XML path is set to. If you view the page HTML you'll find some code that looks like the following:

<script>
  new juicebox({
    configUrl : '/juicebox/xml/entity/node/33/field_gallery/default',
    containerId : 'juicebox-xml-entity-node-33-field_gallery-default',
    galleryWidth : '100%',
    galleryHeight : '500px'
  });
</script>

In this example the XML url is "/juicebox/xml/entity/node/33/field_gallery/default". Can you try to visit the URL (whatever version comes up in your case) directly in your browser and let me know what you see? This is a relative url so in your case you would need to add "http://localhost" to it (e.g. http://localhost/juicebox/xml/entity/node/33/field_gallery/default). If all is working correctly your browser will show you a bunch of XML and if not the specific error the results, such as "not found" or "access denied" will be useful to note.

Also, no matter what results you encounter from this test, can you let me know what your specific XML URL is... or simply just paste the full embed code you find into this issue report? All these details might shed some light into what might be unique about your case.

Lastly, are you using any special field-level permissions controls in your setup (anything like the "field permissions" module)?

abhishek.r’s picture

I followed your instructions and visited my URL(which is http://istecet.org:8082/juicebox/xml/entity/node/4/field_imageg/default) and it gave the following error:

XML Parsing Error: XML or text declaration not at start of entity
Location: http://istecet.org:8082/juicebox/xml/entity/node/4/field_imageg/default
Line Number 1, Column 55:<span data-thmr='thmr_1' class='devel-themer-wrapper'><?xml version="1.0" encoding="UTF-8"?>
------------------------------------------------------^

I could see that the problem was related to the devel themer module i was using. I disabled devel-themer and the gallery worked!! Thanks a lot for your help!! This is a great module and the only one of its kind. Just the one i was looking for.

rjacobs’s picture

I see, that's quite an interesting discovery. I suppose that all makes sense as I think the theme developer module tries to wrap everything that goes through any Drupal theme function in special tags. Even though the XML output that this Juicebox integration creates is not something that gets displayed anywhere, there are still some Drupal theme functions involved in its rendering. If theme developer is adding any tags to it this will lead to invalid Juicebox XML.

Just out of curiosity, what version of theme developer are you using? Is it the most recent dev from 2012-Dec-19? I just want to see if this could be a common point of confusion for others as I suppose many Juicebox module users could also be theme developer module users.

abhishek.r’s picture

Yes, i was using the latest one. Theme developer version 7.x-1.x-dev.

rjacobs’s picture

Title: Images are not being loaded on to the gallery » Theme developer module corrupts Juicebox XML structure (Images are not loaded on to the gallery)
Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Category: support » task
Priority: Normal » Minor

I gave the theme developer module a whirl, and from what I can see it indeed flat-out breaks the rendering of the XML that Juicebox requires. There are two reasons for this:

  1. It somewhat hijacks the Drupal theme() function and injects special tags into the output of all theme hooks. Because the Juicebox module uses a theme function while rendering the Juicebox XML, the XML structure gets corrupted.
  2. It injects some jquery variables via hook_exit, which also corrupts the XML structure. This would happen even if we did not use a theme function in the rendering of the Juicebox XML.

From what I can see there is no easy way to exclude the theme developer module from touching our Juicebox XML, so I don't think there is any graceful way to make these modules play nice together. However, given that having both enabled at the same time does not lead to any catastrophic failures, and given that the theme developer module is not intended to be left enabled for extended periods of time, I'm thinking this is not too big of a deal.

I should probably just add a warning message via hook_requirements to notify people that they should expect problems if both these modules are enabled at the same time.

rjacobs’s picture

Component: Miscellaneous » Documentation
Status: Active » Fixed

I just updated the project page and the readme to reference these notes. I also added a check in hook_requirements that will display an error on /admin/reports/status if both Juicebox and Theme Developer are enabled at the same time. The relevant commit is:

http://drupalcode.org/project/juicebox.git/commit/066b82a

Thanks abhishek.r for smoking out this incompatibility. Knowing this will be very useful in the future.

rwinikates’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2
Component: Documentation » Code
Category: task » bug
Priority: Minor » Normal
Status: Fixed » Active

I'm having the same issue, and I don't have Theme Developer enabled. Here's the error when I visit the XML page in Chrome (mysite.com/juicebox/xml/entity/node/6646/field_photo/default):

This page contains the following errors:
error on line 1 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

And when I view source on that page:

 <?xml version="1.0" encoding="UTF-8"?>
<juiceboxgallery
  galleryWidth="100%"
  galleryHeight="100%"
  
>
  <image imageURL="http://mysite.com/sites/mysite/files/38565_419365541959_7734031959_5419142_3882581_n%20-%20Copy.jpg"
    thumbURL="http://mysite.com/sites/mysite/files/styles/thumbnail/public/38565_419365541959_7734031959_5419142_3882581_n%20-%20Copy.jpg?itok=48RPo3SC"
    linkURL="http://dscc15.ngpvanhost.com/sites/mysite/files/38565_419365541959_7734031959_5419142_3882581_n%20-%20Copy.jpg"
    linkTarget="_blank">
    <title>adfsa</title>
    <caption><![CDATA[asdf]]></caption>
  </image>
  <image imageURL="http://mysite.com/sites/mysite/files/royalty_free_eagle_0.jpg"
    thumbURL="http://mysite.com/sites/mysite/files/styles/thumbnail/public/royalty_free_eagle_0.jpg?itok=Aj6WYOyK"
    linkURL="http://mysite.com/sites/mysite/files/royalty_free_eagle_0.jpg"
    linkTarget="_blank">
    <title>fdas</title>
    <caption><![CDATA[afd]]></caption>
  </image>
</juiceboxgallery>

Especially of note is the leading space there. Could that be the issue?

Happens to anonymous users as well as user1. Here are the modules enabled, nothing seems all that crazy:

admin_menu
admin_menu_toolbar
block
block_class
chart
ckeditor
clone
contact
contextual
ctools
ctools_custom_content
efq_views
entity
fapi_validation
fb_likebox
field
field_sql_storage
field_ui
file
file_entity
filter
follow
googleanalytics
honeypot
image
imce
juicebox
libraries
link
linkit
media
menu
menu_attributes
module_filter
node
oauth_common
openid
overlay
page_manager
panels
panels_ipe
path
pathauto
piwik
redirect
securepages
simpletest
simplified_menu_admin
site_verify
system
text
token
update
user
views
views_bulk_operations
views_content
views_ui

I also tried it with a minimal install profile plus juicebox dependencies and it worked. So something in there is the problem. I'm working to track that down, but any thoughts out there might be useful. List of modules when working here:
block
dblog
field
field_sql_storage
field_ui
file
filter
image
juicebox
libraries
minimal
node
system
text
update
user

rwinikates’s picture

Also, there is no leading space in the xml document on the working, minimal install.

rwinikates’s picture

Status: Active » Postponed

Disregard, turns out it was an issue with one of our custom modules, after further testing. I'll post back if I find out what exactly we were doing that messed with this.

rwinikates’s picture

Status: Postponed » Active

Ah-hah! It wasn't one of our custom modules, but a dependency I had overlooked: Form API Validation is the culprit.

Anyone have ideas as to why that would cause a space at the beginning of the XML generation? Any way to fix that?

Also, perhaps this issue needs a new title.

rjacobs’s picture

Hi rwinikates. I had a look and I think the error you are encountering is related to this existing error report (from the "Form API Validation" error queues):

#1863146: There is whitespace at the beginning of the .module file

Any modules that print something before the page headers are sent (even inadvertently due to white-space within their code) can cause this kind of problem. See the above linked issue for more... it looks like you just need to update to at least the dev version of "Form API Validation" (or wait until they issue a full new release).

rwinikates’s picture

The dev version of Form API validation worked for me, thanks for helping track that down.

rwinikates’s picture

Status: Active » Closed (works as designed)

Closing.

rjacobs’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Component: Code » Documentation
Category: bug » support

Great, thanks for confirming.

As this is technically a separate issue, and as I want to make it easy for others using both Juicebox and Form API validation to find the resolution, I opened a temp issue titled specifically to flag this:

#1962548: Form API Validation module <= 7.x-2.0 breaks Juicebox (and probably many other modules)

I also switched-back some status values for housekeeping. To summarize:

  • Comments 1-10 relate to the titled issue (incompatibility with Theme Developer module). The "fix" was a documentation update described in comment #10.
  • Comments 11-17 related to the different problem with the Form API validation module, with a fix described in the linked issue above and within that module's issues queues.
gilles9999’s picture

Issue summary: View changes

I tried all the options. But it doesn't work. I am becoming crazy. There is any alternative to Juicebox?