On the first time I try to move from gallery index page 1 to page 2 I get the following error..

Warning: file_get_contents(sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js): failed to open stream: No such file or directory in drupal_build_js_cache() (line 4758 of /home/www.mysite.com/public_html/includes/common.inc)..

Moving from page 2 to 3 or anywhere else there is no error.. Even going back to page 2 there is no error.. Only seems to happen on the first page change..

Anyone got any ideas??

TIA

CommentFileSizeAuthor
#3 With library available.jpg13.88 KBwipeout_dude
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wipeout_dude’s picture

Just an update.. Adding the jquery.colorbox-min.js file to the library directory under sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js breaks the gallery and images aren't shown when clicked..

Moloc’s picture

Status: Active » Postponed (maintainer needs more info)

First, the colorbox library is required by the media_gallery module. So you should install it an the errors will be gone.
README.txt

  20    Required:

  31    d. ColorBox jQuery plugin (latest release, tested with 1.3.17)
  32       - Download from http://colorpowered.com/colorbox and unpack it in
  33         sites/all/libraries (if the directory doesn't exist, create it first).

What do you mean by "breaks the gallery"?
And "images aren't shown when clicked", is this related to #1358244: Incompatible with jQuery Update - Lightbox does not show any picture?

wipeout_dude’s picture

Status: Postponed (maintainer needs more info) » Active
FileSize
13.88 KB

What I mean by "breaks the galley" is that when the colorbox library IS available in sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js, when I click on the first picture in the gallery it never loads.. All I see is the attached.. Clicking the "next" image button will show me the next image..

If I delete the library from sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js the first image clicked shows but a warning is logged..

Warning: file_get_contents(sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js): failed to open stream: No such file or directory in drupal_build_js_cache() (line 4766 of /home/www.domain.com/public_html/includes/common.inc).

Currently testing latest version just downloaded - colorbox-1.3.19.

Moloc’s picture

Just testet colorbox-1.3.19. This version works fine.
If colorbox is not available, you don't see the colorbox. Then you are directed to the detail page of the image. So make the library available again. Clear the cache.

1. If you click the "next" button in the colorbox, is there still a loading icon, or do you see the second image in the colorbox?

2. Go to a detail-image page (the url is like ?q=media-gallery/detail/%/% Note: % in my example is a paceholder for a number). Replace the "detail" word with "lightbox" and open the page. What do you see?

wipeout_dude’s picture

Hmmm... Then thats interesting.. media-gallery must be picking up the colorbox .js file from another module or something because without the library available the image still shows in a colorbox when clicked.. This may be where the issue is..

To answer your questions..
1) I see the second image in the colorbox when clicking the "next" button.. I can click "back" and see the first image in the colorbox as well.. Just doesn't show on the first execution when clicking an image from the thumbnails page..

2) Changing the URL to "lightbox" simply shows the image on its own in the browser, clicking the image takes me back to the "detail" page.. Is this correct?

Moloc’s picture

Title: jquery.colorbox-min.js error when moving through pages of images.. » jquery.colorbox-min.js error / after colorbox lib installation - colorbox does not load first image

Maybe you are right. When i first had a look on your screenshot, i was wondering, why there are two loading icons.

- Do you have colorbox elsewhere (not media_gallery) (on your site) in use?
- Search for colorbox with your Operating System in your Drupal installation.
- Disable Javascript Aggregation in Configuration-Performance, clear cache, goto the gallery page and open the HTML-Source. Search for colorbox.

wipeout_dude’s picture

Yes, looks like this may be part or all of the issue..

I have another module that was created specifically for this site that uses colorbox.. The line in the .module file is..

drupal_add_js($module_path . '/js/jquery.colorbox-min.js', 'file'); //colorbox script

..and its loading this version and the one in the library directory..

My guess is that this should be using the library colorbox .js file so that it only has the one version loaded..

Would this make a difference? What would be the correct way to load the correct file in the custom module so that only one file is loaded and they don't conflict?

Moloc’s picture

Yes, your custom module should use the libraries colorbox. So each module, which requires colorbox, can use the same library and there should be no conflict.

There are different solutions:
1. using a direct path to the libraries (instead of your module-path)
2. a better solution (in my opinion) is using the Libraries API with a fallback to 1. if the module does not exist.
3. if you like to customize the colorbox, maybe the Colorbox module is something for you. (Then - i think - you just need to set a dependency in the .info file)

wipeout_dude’s picture

Thanks Moloc.. That's what the issue was.. Obviously the two .js files were not playing well together..

I am not really much of a coder but the libraries API documentation page gave a simple example that I used to pull up the colorbox .js file from the libraries directory.. This appears to have solved the problem and all is now working with no apparent errors.. I think its still using the css from the custom module even for the gallery images but that's fine as it's consistent..

Moloc’s picture

Status: Active » Fixed

As everything is now solved, i flag this issue as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.