I have file upload field in node edit form. After succesfull upload process (ahah by clicking Upload form button) I am getting thumbnail instead of file upload field. It's standard Drupal behaviour. I would like to know how to change size of image thumbnail generating by Drupal after ajax upload.

Could somebody give me any advice?


Here's want you need to do to modified the image field thumbnail thats display after you upload an image.

You will need to overwrite the imagefield_widget_preview theme function. You can drop this theme overwrite in the template.php file of your theme.

function THEMENANE_imagefield_widget_preview($item = NULL) {
  //By default this returns  theme('imagefield_admin_thumbnail', $item);
  //But If you're going to change it I would recommend replacing it with image-cache.
  //Also you should keep the imagefield-preview div.
  return '<div class="imagefield-preview">' . theme('imagecache', 'your_custom_preset', $item['filepath'], $item['alt'], $item['title']) . '</div>';

This will replace the thumbnail images uploaded using image field.

Hope this helps.

Also remember, to use the name of the theme thats being used when editing. In-case you're using different themes.


If you are thinking to scale up some image so there is no solutions.

Using Imagecache in different ways:

If you are working on template then you can use this code to get a thumbnail of your image.

    pring theme('imagecache', 'preset-name', 'path-to-raw-image', 'alt', 'title', array('class'=> 'thumb'));

In Views, under cck image field configuration, there are different formats that target to Imagecache presets processed images.

If you want to mange the preset output in node preview, then Edit your content type and check Display fields settings.


I use ImageCache in D6 to control thumbnail and other preview sizes. It's a simple and robust image module.

Drupal 7 has these controls in the core.

  • Yes, but how to set preset created in ImageCache to work with form field? I have file upload field, click upload, after succesfull upload process I am getting thumbnail instead of file upload field. It's standard Drupal behaviuor. I don't know how to change size of this thumbnail. – Codium Jun 20 '11 at 20:02
  • once you have set the imagecache settings, you can control the display at /admin/content/node-type/[content-type]/display – user842 Jun 20 '11 at 20:04
  • Thanks, but It's still not what I mean. – Codium Jun 20 '11 at 20:14
  • @drupality can you give us some more explanation regarding what you're expecting ? Can you edit your question to make it clearer ? – tostinni Jun 20 '11 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.