If an uploaded image is smaller that the defined dimensions for the 'preview' version, no preview version is created.

However, Thickbox always links to image.preview.jpg, whether it exists or not. It ought to check that the preview version exists. If not, then it should link to the full version. (image.jpg)

Comments

lakyljuk’s picture

Yes, the same behaviour is with Thickbox for Drupal 5. If there is no preview derivative present, thickbox just fades screen and shows loading image. Obviously no image is loaded, because there is no check, if preview derivative is present or not. As you say - it should load another derivative available automatically. Hope this can be solved.

Thanks

frjo’s picture

Status: Active » Postponed (maintainer needs more info)

I don't use the image module myself so I hope someone will contribute a patch for this.

Robbert’s picture

Since the Thickbox Javascript code is unable to check whether the 'preview' version exists, I solved this issue with the following piece of code in my 'workarounds' module.

function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if(!isset($node->images) || !isset($node->images[IMAGE_ORIGINAL]))
    return;
  
  if(!in_array($op, array('update', 'insert', 'delete')))
    return;
    
  $orig_path = $node->images[IMAGE_ORIGINAL];
  foreach($node->images as $key => $path) {
    if($key == IMAGE_ORIGINAL || $path != $orig_path)
      continue;
    
    $path = _image_filename($orig_path, $key);  
    switch($op) {
      case 'update':
      case 'insert':
        @copy($orig_path, $path);
      break;
      case 'delete':
        file_delete(file_create_path($path));
      break;
    }
  }
}

It basically copies the original image for each image that refers to the original. It's probably not the nicest solution, but it solves it for us.

frjo’s picture

Status: Postponed (maintainer needs more info) » Postponed

Please check out the Colorbox module and see if it handles this better.

Colorbox will most likely be the recommended upgrade path for Thickbox users.

The Thickbox script is getting a bit old and the Colorbox script is a nice modern replacement.