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.

AttachmentSizeStatusTest resultOperations
image_size.patch2.1 KBIgnoredNoneNone

#1

jotarp - October 16, 2008 - 09:40

works great !. Thanks.

#2

MGN - November 25, 2008 - 17:21
Status:needs review» needs work

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

nbz - November 25, 2008 - 19:12
Status:needs work» needs review

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.

AttachmentSizeStatusTest resultOperations
image_size.patch2.89 KBIgnoredNoneNone

#4

sun - July 12, 2009 - 18:38
Status:needs review» won't fix

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

kaakuu - July 12, 2009 - 18:45

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

nbz - July 12, 2009 - 19:15

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.

 
 

Drupal is a registered trademark of Dries Buytaert.