Add options to use different image sizes in node and teaser.
nbz - September 6, 2008 - 05:29
| Project: | Image |
| Version: | 6.x-1.x-dev |
| Component: | image.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Description
Hi, IMO this is a much needed feature and while i have been using Image module for Drupal 6 for a few months, until now I manually edited it to show different image sizes for teasers.
The attached patch is a more complete approach adding a form on the content-type page giving a choice for sizes to use in the body and teaser (defaults being what the module currently does).
Code is a modified version of what is already in image_attach for other node types.
| Attachment | Size |
|---|---|
| image_size.patch | 2.1 KB |

#1
works great !. Thanks.
#2
With the patch, the links to select the image size ( image_link() ) no longer work - the image is always the size set on the content-type page. Thus this patch breaks normal functionality and needs work.
Also, in the copy-and-paste from the image_attach code it looks like you forgot to edit the description to omit the sentence:
'Hidden' will not show the image.That is not one of the options and wouldn't make sense for the image content type.#3
Updated patch fixing the mentioned issues:
You can select the sizes on the page, and also set default sizes per content type. The text about choosing hidden has also been removed.
#4
Image module will soon be a simple wrapper around ImageField providing a content-type. Since ImageFields, resp. CCK, already allow to configure the output for various node build modes, I'm marking this won't fix.
#5
There are many users who use this module and will still be using as Drupal five and six for unforeseen long times. Imagefield has CCK dependency and other dependencies perhaps and all users may not need to actively use or install CCK.
#6
Since writing this patch, I have moved to a different approach that let me unhack image.module - theme overrides.
In my theme's template.php I added:
<?php
/**
* Override the theme settings for image teasers.
*/
function phptemplate_image_teaser($node, $size) {
return l(image_display($node, IMAGE_PREVIEW), 'node/'. $node->nid, array('html' => TRUE));
}
?>
And that changes the image size from thumbnail to preview - just replace IMAGE_PREVIEW with whatever you want.