You are here

README.txt in Media Colorbox 7

INSTALLATION
------------
1. Place the media_colorbox directory into your Drupal modules
   directory (normally sites/all/modules).

2. Enable the module by navigating to:

     Administration » Modules

CONFIGURATION
-------------

1. For your configured media field, go to "Manage display" for the content type 
   with that field and choose the "Media Colorbox" formatter, and configure it. 
   Choose the view mode of the file using "File view mode" for how the media file 
   will be displayed on the page, and the view mode used within Colorbox using 
   "Colorbox view mode".

2. If you are using the Media module to display fields, configure the chosen
   view modes by navigating to:

   Administration » Configuration » Media » File types » Manage display
   
   Select the 'Colorbox Link' formatter for an image or text field, this will create 
   a Colorbox link to the entity displaying the 'Colorbox view mode' inside the 
   Colorbox.
   
   The 'Colorbox Link' formatter is only available for file entities (not node, user, 
   taxonomy or any other type of entity).  Therefore, it is not very useful on any but 
   'Default' view mode for the file type being configured - unless you use the 'Rendered file' 
   formatter for a display setting and select a view mode that uses 'Colorbox Link'.

   If you are directly using a file field, configure the chosen view modes.
   You may want to create additional view modes using hook_entity_info_alter()
   or a module like Display suite.
   
Colorbox Captions
-----------------

You may configure the Media Colorbox field formatter to use a text or text_long field of 
the Media file (file entity) being displayed as the caption in the Colorbox overlay.  From 
the admin/config/media/file-types page select the 'manage display' link for any of the file
types and 

KNOWN ISSUES
------------

The default theme implementation of theme_image_style() does not always include "width"
and "height" attributes on the IMG tag. This causes colorbox to resize to zero.
Override the theme_image_style() to include image dimensions, e.g. with :

/**
 * Override theme_image_style().
 */
function THEME_image_style($variables) {
  $style_name = $variables['style_name'];
  $path = $variables['path'];

  $style_path = image_style_path($style_name, $path);
  if (!file_exists($style_path)) {
    $style_path = image_style_url($style_name, $path);
  }
  $variables['path'] = $style_path;

  if (is_file($style_path)) {
    if (list($width, $height, $type, $attributes) = @getimagesize($style_path)) {
      $variables['width'] = $width;
      $variables['height'] = $height;
    }
  }
  
  return theme('image', $variables);
}

File

README.txt
View source
  1. INSTALLATION
  2. ------------
  3. 1. Place the media_colorbox directory into your Drupal modules
  4. directory (normally sites/all/modules).
  5. 2. Enable the module by navigating to:
  6. Administration » Modules
  7. CONFIGURATION
  8. -------------
  9. 1. For your configured media field, go to "Manage display" for the content type
  10. with that field and choose the "Media Colorbox" formatter, and configure it.
  11. Choose the view mode of the file using "File view mode" for how the media file
  12. will be displayed on the page, and the view mode used within Colorbox using
  13. "Colorbox view mode".
  14. 2. If you are using the Media module to display fields, configure the chosen
  15. view modes by navigating to:
  16. Administration » Configuration » Media » File types » Manage display
  17. Select the 'Colorbox Link' formatter for an image or text field, this will create
  18. a Colorbox link to the entity displaying the 'Colorbox view mode' inside the
  19. Colorbox.
  20. The 'Colorbox Link' formatter is only available for file entities (not node, user,
  21. taxonomy or any other type of entity). Therefore, it is not very useful on any but
  22. 'Default' view mode for the file type being configured - unless you use the 'Rendered file'
  23. formatter for a display setting and select a view mode that uses 'Colorbox Link'.
  24. If you are directly using a file field, configure the chosen view modes.
  25. You may want to create additional view modes using hook_entity_info_alter()
  26. or a module like Display suite.
  27. Colorbox Captions
  28. -----------------
  29. You may configure the Media Colorbox field formatter to use a text or text_long field of
  30. the Media file (file entity) being displayed as the caption in the Colorbox overlay. From
  31. the admin/config/media/file-types page select the 'manage display' link for any of the file
  32. types and
  33. KNOWN ISSUES
  34. ------------
  35. The default theme implementation of theme_image_style() does not always include "width"
  36. and "height" attributes on the IMG tag. This causes colorbox to resize to zero.
  37. Override the theme_image_style() to include image dimensions, e.g. with :
  38. /**
  39. * Override theme_image_style().
  40. */
  41. function THEME_image_style($variables) {
  42. $style_name = $variables['style_name'];
  43. $path = $variables['path'];
  44. $style_path = image_style_path($style_name, $path);
  45. if (!file_exists($style_path)) {
  46. $style_path = image_style_url($style_name, $path);
  47. }
  48. $variables['path'] = $style_path;
  49. if (is_file($style_path)) {
  50. if (list($width, $height, $type, $attributes) = @getimagesize($style_path)) {
  51. $variables['width'] = $width;
  52. $variables['height'] = $height;
  53. }
  54. }
  55. return theme('image', $variables);
  56. }