diff -upr --unidirectional-new-file node_images.orig/node_images.admin.inc node_images/node_images.admin.inc
--- node_images.orig/node_images.admin.inc 2008-08-23 01:53:35.000000000 -0700
+++ node_images/node_images.admin.inc 2009-06-20 17:47:08.000000000 -0700
@@ -45,6 +45,13 @@ function node_images_admin_settings() {
'#description' => t('The default maximum file size a user can upload. If a maximum resolution is set, the size will be checked after the file has been resized.'),
'#field_suffix' => t('MB'),
);
+ $form['node_images_display'] = array(
+ '#type' => 'select',
+ '#title' => t('Image Display'),
+ '#default_value' => variable_get('node_images_display', 'default'),
+ '#description' => t('This sets the display type for Node Images when the thumbnail is clicked on. If the \'lightbox\' or \'thickbox\' modules are enabled, then these can be selected here as the default output.'),
+ '#options' => _node_images_get_display_options()
+ );
$form['node_images_extensions'] = array(
'#type' => 'textfield',
'#title' => t('Default permitted image extensions'),
@@ -68,4 +75,29 @@ function node_images_admin_settings() {
);
return system_settings_form($form);
-}
\ No newline at end of file
+}
+
+/******************************************************
+ * Display extension settings - integration of lightbox & thickbox
+ *****************************************************/
+
+/**
+ * return an array of display options dependent upon modules that are enabled
+ *
+ * the 'key' part of the array should contain the module name
+ * the 'value' part of the array is the display name in the settings.
+ * any 'key' defined here should also form the name of an implemented associated function theme_node_images_thumb_[key](&$node, &$image, &$parameters) which contains the appropriate js or whatever to trigger the display module.
+ *
+ * add as necessary and write the appropriate theme_node_images_thumb_[key](&$node, &$image, &$parameters)
+ */
+
+function _node_images_get_display_options() {
+ $ret = array('default' => t('Node Images (default)'));
+ if (module_exists('lightbox2')) {
+ $ret += array('lightbox2' => t('Lightbox'));
+ }
+ if (module_exists('thickbox')) {
+ $ret += array('thickbox' => t('Thickbox'));
+ }
+ return $ret;
+}
diff -upr --unidirectional-new-file node_images.orig/node_images.install node_images/node_images.install
--- node_images.orig/node_images.install 2008-08-23 01:53:35.000000000 -0700
+++ node_images/node_images.install 2009-06-20 17:54:38.000000000 -0700
@@ -19,6 +19,7 @@ function node_images_uninstall(){
variable_del('node_images_thumb_resolution');
variable_del('node_images_uploadsize_default');
variable_del('node_images_max_images');
+ variable_del('node_images_display');
$names = node_get_types('names');
foreach ($names as $key => $name) {
diff -upr --unidirectional-new-file node_images.orig/node_images.module node_images/node_images.module
--- node_images.orig/node_images.module 2009-02-03 05:45:50.000000000 -0800
+++ node_images/node_images.module 2009-06-20 20:53:07.000000000 -0700
@@ -276,6 +276,15 @@ function node_images_theme() {
'node_images_gallery_thumbs' => array(
'arguments' => array('thumbs' => NULL, 'cols' => 2),
),
+ 'node_images_thumb_default' => array(
+ 'arguments' => array('node' => NULL, 'image' => NULL, 'parameters' => NULL),
+ ),
+ 'node_images_thumb_lightbox2' => array(
+ 'arguments' => array('node' => NULL, 'image' => NULL, 'parameters' => NULL),
+ ),
+ 'node_images_thumb_thickbox' => array(
+ 'arguments' => array('node' => NULL, 'image' => NULL, 'parameters' => NULL),
+ ),
);
}
@@ -736,6 +745,13 @@ function theme_node_images_view($node, $
$output = '';
$i = 0;
+ // get the 'display' setting
+ $display = variable_get('node_images_display','default');
+ // check the module is still enabled. set 'default' if not.
+ if (!module_exists($display)) {
+ $display = 'default';
+ }
+
// set maximum number of images for teaser/body
$view = ($teaser ? 'teaser' : 'body');
if (!$count) {
@@ -762,10 +778,9 @@ function theme_node_images_view($node, $
$width = 420;
$height = 315;
}
-
+ $parameters = array('width' => $width, 'height' => $height, 'thumb' => $thumb, 'desc' => $description);
if ($format == 'thumbs') {
- $output .= ''.$thumb.' ';
+ $output .= theme('node_images_thumb_'.$display, $node, $image, $parameters);
}
else {
$output .= $fullsize.' ';
@@ -780,6 +795,53 @@ function theme_node_images_view($node, $
return $output;
}
+/**
+ * theme_node_images_thumb_xxx - display functions for thumbnails to enable other modules to handle display of full size images, where 'xxx' = module name
+ * i.e. thickbox, lightbox2 etc.
+ *
+ * @param $node
+ * @param $image - image to display
+ * @param $parameters - array of display parameters - width, height etc.
+ * @return html to display
+ */
+
+/**
+ * theme_node_images_thumb_default
+ *
+ * node_images default (original) display
+ *
+ */
+
+function theme_node_images_thumb_default(&$node, &$image, &$parameters) {
+ return ''.$parameters['thumb'].' ';
+}
+
+/**
+ * theme_node_images_thumb_lightbox2
+ *
+ * lightbox2 output
+ *
+ */
+
+function theme_node_images_thumb_lightbox2(&$node, &$image, &$parameters) {
+
+ return ''.$parameters['thumb'].' ';
+
+}
+
+/**
+ * theme_node_images_thumb_thickbox
+ *
+ * thickbox output
+ *
+ */
+
+
+function theme_node_images_thumb_thickbox(&$node, &$image, &$parameters) {
+ return 'nid . '"/>'.$parameters['thumb'].' ';
+}
+
/************************************************************
* Helper functions - other