magento how to add custom image thumbnail in edit form

===================== in app\code\local\Nikunj\Contact\Block\Adminhtml\Contact\Edit\Tab\Form.php

For a specific case where the need to add a specific image, the logical way is to use the input_type “image” like this:

1
2
3
4
5
$fieldset->addField('imagename', 'image', array(
    'label'     => Mage::helper('customerprojects')->__('Thumbnail'),
    'name'      => 'imagename',
));

And the result is the following form:

image showing the icon but with an input field with a browse button and a delete checkbox=======================================================================

if u not store full path in data base then set this code =>

 if($form->getElement(‘imagename‘)->getValue() != ”)
{
$p = $form->getElement(‘imagename‘)->getValue();
$form->getElement(‘filename’)->setValue(‘contact/resized/’ . $p);
}

enjoy 🙂