I have had Colorbox images working properly on my site for quite some time, but I just noticed that the Colorbox display behavior has changed. I use the module to display "Colorbox large" images in my content (using the Insert module), and larger original-size images when clicking on the inserted images. Now, for some reason all of my Colorbox images are displayed as thumbnails. Example behavior can be seen here:

https://www.musclecarresearch.com/gm-3905525-autopsy

Click on any of the images. Instead of large original images you'll see thumbnails in the Colorbox. I'm using version 1.3.31 of the Colorbox plugin. What might be going on here?

CommentFileSizeAuthor
#12 colorbox-settings.jpg137.63 KBsah62
#4 colorbox-options.jpg31.9 KBsah62
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

frjo’s picture

Status: Active » Fixed

You have set max width to 130 in the Colorbox settings on your site. Reset that and it will display correctly again.

"colorbox":{"opacity":"0.85","current":"{current} of {total}","previous":"\u00ab Prev","next":"Next \u00bb","close":"Close","maxWidth":130,"maxHeight":513,"fixed":true,"width":130,"height":513}});
smplce’s picture

Status: Fixed » Active

Hi,
I´m having the same issue after updating to the latest version (library and module). I see the maxWidth parameter with value 130 in sourcecode but never set it. In the Drupal backend it´s set to 98%. I would change the 130 to some other value if I would know where ... can you help me?

Thanks a lot

frjo’s picture

Status: Active » Fixed

Resave the Colorbox settings and if that doesn't help uninstall and then reinstall the Colorbox module.

sah62’s picture

Status: Fixed » Active
FileSize
31.9 KB

Thank you for the quick response!

That's strange - I've been using the default options. When I look at the custom options I see default values of 100% for max width and max height.

I just tried disabling, uninstalling, and reinstalling the module and the behavior remains the same, except that the max width and height were initially 98%. I reset them to 100%, saved, flushed caches, and no change. I've attached a screen shot showing the option values.

frjo’s picture

Check the variables table in your database and look for any colorbox_* variables. Is the ""width":130,"height":513" there then delete them.

Is it working now?

If not, my guess would be that you have some other module/theme that messes things up.

sah62’s picture

I deleted both variables; the problem persists. I'm testing right now without having saved the Colorbox options. No variable values are set in the database.

I also tried uninstalling Colorbox again. When that's done, I can click on an image and see the full-sized version displayed in a window. I reinstalled the module and the thumbnail Colorbox behavior returns. Do you know of any modules that cause conflicts? Is there any place in the code that I could check for variable values to help figure out why the height and width are mis-set?

frjo’s picture

Never heard about a problem like this before. Something is setting the Colorbox values and you need to find out what it is to solve your problem. Maybe do a search for "colorbox" in your code base and see what turns up?

sah62’s picture

I got hits in two modules: MediaFront and Libraries, but neither looks like the culprit. From MediaFront (file mediafront_youtube.views_default.inc):

  $handler->display->display_options['fields']['title']['node_in_colorbox_width'] = '600';
  $handler->display->display_options['fields']['title']['node_in_colorbox_height'] = '600';

From Libraries (file libraries.drush.inc):

  $filename = basename(COLORBOX_DOWNLOAD_URI);
  $dirname = basename(COLORBOX_DOWNLOAD_URI, '.zip');

  // Remove any existing Colorbox plugin directory
  if (is_dir($dirname)) {
    drush_log(dt('A existing Colorbox plugin was overwritten at @path', array('@path' => $path)), 'notice');
  }
  // Remove any existing Colorbox plugin zip archive
  if (is_file($filename)) {
    drush_op('unlink', $filename);
  }

  // Download the zip archive
  if (!drush_shell_exec('wget '. COLORBOX_DOWNLOAD_URI)) {
    drush_shell_exec('curl -O '. COLORBOX_DOWNLOAD_URI);
  }

  if (is_file($filename)) {
    // Decompress the zip archive
    drush_shell_exec('unzip -qq -o '. $filename);
    // Remove the zip archive
    drush_op('unlink', $filename);
  }

  // Set working directory back to the previous working directory.
  chdir($olddir);

  if (is_dir($path .'/'. $dirname)) {
    drush_log(dt('Colorbox plugin has been downloaded to @path', array('@path' => $path)), 'success');
  }
  else {
    drush_log(dt('Drush was unable to download the Colorbox plugin to @path', array('@path' => $path)), 'error');
  }

I'm tempted to try installing an older version of Colorbox to see if that changes anything.

sah62’s picture

Reverting to 7.x-2.0 made no difference. I've re-installed 7.x-2.2.

frjo’s picture

I have no more tips for you unfortunately. It looks like you need someone to take a good look at your site and do some bug tracking.

smplce’s picture

Hi, thanks your help!
I tried all the things mentioned above, additional the git page of colorbox says:

Version 1.3.31 - 2013/1/28
Fixed a size-calculation bug introduced in the previous commit.

I also tried installing this Version, without success.

Do you know any technique to overwrite:

...,"overlayClose":true,"maxWidth":130,"maxHeight":513, ...

from the script section drupal creates? I think this causes all the problems. It´s not a nice way, but if it works I would hardcode this to 98%.

Thanks in advance

sah62’s picture

FileSize
137.63 KB

A clue: I captured the value of the $js_settings array in colorbox.module function _colorbox_doheader() before and after the call to drupal_alter('colorbox_settings', $data, $style); see attached image. Something is definitely changing the values of maxWidth and maxHeight.

I can temporarily comment out the call to drupal_alter to get things working, but I'd rather find the culprit. As noted above I couldn't find any other modules that appear to implement a hook that changes the values. I should be looking for a function name that includes "colorbox_settings_alter", right?

sah62’s picture

I found my culprit - it's the MediaFront module. There's a hook implemented in mediafront/players/osmplayer/osmplayer.module, function osmplayer_colorbox_settings_alter. It's adjusting the height and width values based on mediafront preset parameters. I'm going to follow up in #1689734: Mediafront not working in colorbox.

Thanks for the tips, frjo.

frjo’s picture

Title: All Colorbox Images Displayed as Thumbnails » All Colorbox Images Displayed as Thumbnails when MediaFront module is used
Status: Active » Closed (duplicate)

Glad that you found the problem! Nice bug tracking. I mark this as a duplicate then.

#1689734: Mediafront not working in colorbox