? TODO.txt ? patches ? views_defaults.inc ? contrib/image_attach/patches ? contrib/image_gallery/views_defaults.inc Index: image.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v retrieving revision 1.259 diff -u -r1.259 image.module --- image.module 13 Nov 2007 03:21:53 -0000 1.259 +++ image.module 1 Dec 2007 15:32:16 -0000 @@ -11,6 +11,7 @@ if (module_exists('views')) { include(drupal_get_path('module', 'image') .'/views.inc'); + include(drupal_get_path('module', 'image') .'/views_defaults.inc'); } /** @@ -472,9 +473,13 @@ /** * Implementation of hook_block. * - * Offers 2 blocks: latest image and random image + * Offers 2 blocks: latest image and random image. Skip if Views module is enabled */ function image_block($op = 'list', $delta = 0) { + if(module_exists('views')){ + return; + } + switch ($op) { case 'list': $block[0]['info'] = t('Latest image'); Index: views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/views.inc,v retrieving revision 1.4 diff -u -r1.4 views.inc --- views.inc 27 Aug 2007 22:50:39 -0000 1.4 +++ views.inc 1 Dec 2007 15:03:06 -0000 @@ -112,3 +112,58 @@ return $a; } +/** + * Implementation of hook_views_style_plugins() + */ +function image_views_style_plugins() { + $items['image_gallery'] = array( + 'name' => t('Image: Gallery'), + 'theme' => 'image_gallery_view', + 'validate' => 'views_ui_plugin_validate_list', + 'needs_fields' => true, + ); + return $items; +} + +/** + * Display the nodes of a view as an image gallery. + */ +function theme_image_gallery_view($view, $nodes, $type) { + drupal_add_css(drupal_get_path('module', 'image_gallery') .'/image_gallery.css'); + + $fields = _views_get_fields(); + + // get the size of images + // NB: in the ulikely event thath user adds more than one image field with different sizes... this breaks + foreach ($view->field as $field) { + if ($field['tablename'] == 'image_node') { + $size = image_get_sizes($field['options']); + } + } + $width = $size['width']; + // We'll add height to keep thumbnails lined up. + $height = $size['height'] + 25; + + $content .= '\n"; + + if ($content) { + return $content; + } +} Index: contrib/image_gallery/image_gallery.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/image_gallery.css,v retrieving revision 1.7 diff -u -r1.7 image_gallery.css --- contrib/image_gallery/image_gallery.css 18 Jul 2007 17:04:31 -0000 1.7 +++ contrib/image_gallery/image_gallery.css 16 Nov 2007 21:36:12 -0000 @@ -44,6 +44,13 @@ ul.images li { float : left; - margin : 1em; + margin: 1em; + margin-left:0; + margin-right:2em; + padding:0; background: transparent; } +/* gallery view in a block */ +.block ul.images li { + margin-top:0; +} \ No newline at end of file Index: contrib/image_gallery/image_gallery.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/image_gallery.module,v retrieving revision 1.20 diff -u -r1.20 image_gallery.module --- contrib/image_gallery/image_gallery.module 7 Sep 2007 19:26:24 -0000 1.20 +++ contrib/image_gallery/image_gallery.module 1 Dec 2007 15:26:34 -0000 @@ -1,6 +1,11 @@ $node->nid)); + if ($tid) { + // Depending on whether the Views module is enabled, either: + // - build (and theme) the image gallery ourselves + // - embed a view to show the image gallery, appending it to the themed child gallery list + if (module_exists('views')) { + $view = views_get_view('image_gallery'); + } + else { + $result = pager_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d ORDER BY n.sticky DESC, n.created DESC"), variable_get('image_images_per_page', 6), 0, NULL, $tid); + while ($node = db_fetch_object($result)) { + $images[] = node_load(array('nid' => $node->nid)); + } } $gallery = taxonomy_get_term($tid); @@ -172,6 +185,11 @@ $breadcrumb[] = array('path' => $_GET['q']); menu_set_location($breadcrumb); $content = theme('image_gallery', $galleries, $images); + + if ($view) { + $content .= views_build_view('embed', $view, array($tid), $view->use_pager, $view->nodes_per_page, 0, 0); + } + return $content; } @@ -352,8 +370,8 @@ $content .= "\n"; } - if (!empty($images)) { - $content .= '