I am currently running 6.x-1.0-alpha5. I tried to move over to beta 3 and had problems with image attach... specifically that the images did not actually display on the pages. I made sure to add the new permissions, and even tried deleting the block based on some of the comments in the release node... without any success.

I put the code back in place for alpha 5 but the db is still the newer version.

Anyone else have this problem?

Thanks,

tdivito

Comments

joachim’s picture

Do you mean the actual Block, rather than just the attached images in the node?
I don't think I changed any theme functions for that, but try clearing all your caches including the theme registry.

tdivito’s picture

I don't think I have been using a block... unless a block is placed inside of the node's content.

Inside of the node's content div, I saw a div named image-attach-body... but nothing else was in the div.... it was empty.

How to I clear cache for the theme registry... I have been clearing the cache using admin/settings/performance and that did not help.

Thanks for your help!

joachim’s picture

I think someone filed a similar problem recently. Try looking in the issue queue to see how that was resolved.
You clear the theme registry by visiting the theme admin page IIRC -- check the docs.

tdivito’s picture

Clearing theme registry did not help.

I found something in the issue queue about this problem when running drupal from a sub directory, which I am not doing, and that issue was found to be being caused by a module that I don't use anyway.

Thanks for helping me with this!

joachim’s picture

The DIV with class image-attach-body is produced by theme_image_attach_body.
Can you check by overriding that in your theme whether it gets called and what parameters it is receiving?

tdivito’s picture

I know how to override the function, but how do I find out what parameters it is receiving?

Thanks!

joachim’s picture

Install devel module, do:
dsm($variable);

tdivito’s picture

So, um.... I am pretty sure that I was causing the problem myself. I knew how to override the template function because I did it already in order to display captions under the images on the nodes. Sorry for the false alarm

Could you take a quick look at the code (which I pulled from someone else's help ticket somewhere) and see if anything seems really wrong based on the new version?

Thanks so much for all of your help!

function phptemplate_image_attach_body($node) {
$img_size = variable_get('image_attach_size_body_'. $node->type, IMAGE_THUMBNAIL);

if ($img_size != IMAGE_ATTACH_HIDDEN) {
drupal_add_css(drupal_get_path('module', 'image_attach') .'/image_attach.css');

$image = node_load($node->iid);
if (!node_access('view', $image)) {
// If the image is restricted, don't show it as an attachment.
return NULL;
}
$info = image_get_info(file_create_path($image->images[$img_size]));
$caption = node_teaser($image->body);

$output = '

';
$output .= l(image_display($image, $img_size), "node/$node->iid", array('html' => TRUE));
$output .= '
' . $caption . '

';
$output .= '

'."\n";

return $output;
}
}

joachim’s picture

Category: bug » support
Status: Active » Closed (fixed)

Your theme function looks fine.
Note that it gains an extra parameter for DRUPAL-6--1-0-ALPHA6.

I've made a patch to improve the theming functions anyway: if you are able, please test: #412288: restructure theme_image_attach_body/teaser .