Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The preview of the default image in the widget settings is made thus:
if (!empty($widget['default_image'])) {
$form['default']['default_image_thumbnail'] = array(
'#type' => 'markup',
'#value' => theme('imagefield_image', $widget['default_image'], '', '', array('width' => '150'), FALSE),
);
}
Would one of these theme functions not be better suited to this?
// Use to generate a preview (admin view) of an imagefield item for use in
// field item forms and filefield widgets. Invoked by filefield_widget_process.
'imagefield_widget_preview' => array(
'arguments' => array('item' => NULL),
),
// Theme function for the field item elements. allows you to place children
// within the context of the parent.
'imagefield_widget_item' => array(
'arguments' => array('element' => NULL),
),
// Generates and img tag to the admin thumbnail of an ImageField upload.
'imagefield_admin_thumbnail' => array(
'arguments' => array('item' => NULL),
),
Comments
Comment #1
quicksketchI think
imagefield_admin_thumbnail
would be the most expected theme function, but it has the caveat that it creates a new file on your server. We would then have to clean up that file when the default image is deleted/replaced. We definitely could do that, but at this point in the D6 cycle we're probably not going to see a lot of changes to ImageField. Happy to look at patches.