I've made some modifications to the node_images module so that it allows the upload of 2 size images apart the full picture. I've also added the code so that if you want to resize the node images you can do that and you're not forced to re-upload all the images.
The re-resizing part I tried to make it as a tab in the settings page but i couldn't (if anyone can do it feel free to do it) so it's in the admin/build part of the administrations (after all it has something to do with buildin the content of the site).
If anyone is interested in this let me know

CommentFileSizeAuthor
#4 node_images_5.patch2.81 KBtic2000
#2 node_images_4.patch35.96 KBtic2000

Comments

janosch’s picture

That sounds very great, i would definately need this. Maybe as well an option to delete the original and keep the 2 resized? That way users can upload large pictures without being annoyed by a limit notice, and it wouldn't take as much space up either.

tic2000’s picture

StatusFileSize
new35.96 KB

I don't have a cvs account (or at least is this I think it's called) and I don't know and don't have the time to learn how to create a patch file. I can try to upload my new module file. If anyone can create a patch from it, feel free to do so. For the new file to work, you need to alter the node_images table inserting 2 new columns (mediumpath varchar(255) NOT NULL default '' and mediumsize int(10) unsigned NOT NULL default '0')
If anyone interested my function to display images is:

/**
 * Show node images in the node view.
 */
function [template_name]_node_images_view($node, $teaser, $page, $format = NULL) {
  if (arg(2) == 'image_gallery' || empty($node->node_images)) return;

  $output = '';
  $i = 0;

  // set maximum number of images for teaser/body
  $view = ($teaser ? 'teaser' : 'body');
  $count = variable_get('node_images_'.$view.'_images_'.$node->type, 2);
  if (isset($count) && $count === 0) return;
  if (!$format) {
    $format = variable_get('node_images_'.$view.'_format_'.$node->type, 'thumbs');
  }

  foreach((array)$node->node_images as $id=>$image) {
    $description = check_plain($image->description);
    $pattern = '<img src="%path" alt="%description" class="%class" />';
    $thumb = strtr($pattern, array('%path'=>file_create_url($image->thumbpath), '%description'=>$description, '%class' => 'node_image_tn'));
	$medium = strtr($pattern, array('%path'=>file_create_url($image->mediumpath), '%description'=>$description, '%class' => 'node_image_md'));
    $fullsize = strtr($pattern, array('%path'=>file_create_url($image->filepath), '%description'=>$description, '%class' => 'node_image'));

    if ($info = getimagesize($image->filepath)) {
      $width = $info[0] + 36;
      $height = $info[1] + 36;
    }
    else {
      $width = 420;
      $height = 315;
    }

    if ($format == 'thumbs') {
      $output .= '<a href="'.url('node/'.$node->nid).'" title="'.$description.'">'.$thumb.'</a> ';
    }
	elseif ($format == 'medium') {
      $output .= '<a href="javascript:void(0);" title="'.$description.'" onclick="window.open(\''.
        file_create_url($image->filepath).'\', \'\', \'height='.$height.',width='.$width.'\');">'.$medium.'</a> ';
    }
	else {
	  $output .= $fullsize . ' ';
	}
    if ($count>0 && ++$i >= $count) break;
  }
  return $output;
}

I use a class for node images cause I want my pages to be XHTML 1.0 strict, and setting the width and height of images in img tag brakes the strictness.

tic2000’s picture

A note anyway, even if an option to delete the original image is set, the warning will still remain, cause the image is uploaded before any resizing and copying. As a consequence the image still has to respect the server limits.

tic2000’s picture

Category: task » feature
StatusFileSize
new2.81 KB

OK, I have done a proper patch to create an admin page for resizing the thumbnails after they are uploaded. To resize you go first to admin/settings/node_images and enter the size you want, after that you go to admin/build/node_images, check the box and hit enter. That's all.
Maybe I'll come with the path to enable the thickbox gallery for node images when I'll have the time.

summit’s picture

Hi,
Will this patch be committed? Looking for resizing option.

greetings,
Martijn

ahoria’s picture

A D6 port maybe?