I uploaded an image file using the managed_file Form API type, but after uploading the image it does not appear as a thumbnail beside the field. What is rendered is the file name of the image with a link to the image and a small icon.
How do I show the thumbnail of the image after uploading it (like the image preview from the core Image field)?
Also how can I show a default image beside it (if it has a default value)?
This is my code:
$form['logo'] = array(
'#title' => t('Logo'),
'#type' => 'managed_file',
'#required' => TRUE,
'#default_value' => variable_get('logo', ''),
'#upload_location' => 'public://',
'#upload_validators' => array(
'file_validate_extensions' => array('gif png jpg jpeg'),
'file_validate_size' => array(0.3*1024*1024),
)