? test.patch Index: contrib/image_attach/image_attach.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_attach/image_attach.install,v retrieving revision 1.1.4.7 diff -u -p -u -p -r1.1.4.7 image_attach.install --- contrib/image_attach/image_attach.install 5 Jul 2007 04:25:19 -0000 1.1.4.7 +++ contrib/image_attach/image_attach.install 10 Sep 2007 19:28:36 -0000 @@ -27,6 +27,7 @@ function image_attach_install() { function image_attach_uninstall() { db_query('DROP TABLE {image_attach}'); variable_del('image_attach_existing'); + variable_del('image_attach_block_0_size'); } /** Index: contrib/image_attach/image_attach.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_attach/image_attach.module,v retrieving revision 1.9.2.17 diff -u -p -u -p -r1.9.2.17 image_attach.module --- contrib/image_attach/image_attach.module 18 Aug 2007 19:00:01 -0000 1.9.2.17 +++ contrib/image_attach/image_attach.module 10 Sep 2007 19:38:17 -0000 @@ -60,6 +60,66 @@ function image_attach_admin_settings() { } /** + * Implementation of hook_block(). + */ +function image_attach_block($op = 'list', $delta = 0, $edit = array()) { + switch ($op) { + case 'list': + $blocks[0] = array( + 'info' => t('Attached Images'), + 'status' => TRUE, + 'weight' => 0, + 'visibility' => 1, + 'pages' => 'node/*', + ); + return $blocks; + + case 'view': + if ($delta == 0) { + if (arg(0) == 'node' && is_numeric(arg(1))) { + $node = node_load(arg(1)); + if ($node->iid) { + $image = node_load($node->iid); + if (node_access('view', $image)) { + $img = image_display($image, variable_get('image_attach_block_0_size', IMAGE_THUMBNAIL)); + return array( + 'subject' => t('Attached Images'), + 'content' => l($img, "node/$node->iid", array(), NULL, NULL, FALSE, TRUE), + ); + } + } + } + } + break; + + case 'configure': + if ($delta == 0) { + $image_sizes = array(); + foreach (image_get_sizes() as $key => $size) { + $image_sizes[$key] = $size['label']; + } + $form['image_attach_block_0_size'] = array( + '#type' => 'select', + '#title' => t('Image size'), + '#default_value' => variable_get('image_attach_block_0_size', IMAGE_THUMBNAIL), + '#options' => $image_sizes, + '#description' => t("This determines the size of the image that appears in the block."), + ); + return $form; + } + break; + + case 'save': + if ($delta == 0) { + variable_set('image_attach_block_0_size', $edit['image_attach_block_0_size']); + } + break; + } +} + + + +/** * implementation of hook_form_alter() */ function image_attach_form_alter($form_id, &$form) {