0
votes

I'm working in Drupal 6. I need thumbnails for the images that are getting uploaded to my site, but, for a variety of reasons, I need several different sizes for different kinds of images. Thus I'm in effect rolling my own thumbnails with imagecache and adding some hooks to get them inserted into the right places. The result is that I don't really need or want the thumbnails that imagefield wants to generate, and would prefer not having them clutter up my server. Is there any way to get imagefield to just not create these thumbnails? Or would that screw up something else that I'm not thinking about? Thanks!

1
Hi, I think you can set a rol just for creating thumbnails and that rol will be used only for you, the rest of the user just will be using the standard upload system. - Jose Daniel

1 Answers

1
votes

there aren't any ways to do this without hacking the module, which is a shame!

Try this:

When you create your own thumbnails, run the following code on the uploaded file.

file_delete(imagefield_file_admin_thumb_path($file, FALSE));

Here's the function in imagefield_file.inc (called on line 22 in imagefield_file.inc):

/**
 * Implementation of hook_file_delete().
 *
 * Delete the admin thumbnail when the original is deleted.
 */
function imagefield_file_delete($file) {
  if (imagefield_file_is_image($file)) {
    file_delete(imagefield_file_admin_thumb_path($file, FALSE));
  }
}

I can't test it at the moment I'm afraid, but it might be a starting point! It's also a bit messy, as the thumbnail will be generated, and then deleted! According to line 12 in imagefield_file.inc, the thumbnails are generated on preview...you might be able to override this somehow?