I am learning Magento and trying to make a module to manage Chefs in a Restaurant. I created an upload button to upload image and it works (images save in directory, file name saved in database).
But I don't know how to have a small preview of the image next to the button when the image has been uploaded (like when uploading Catalog picture). At the moment, when I click "edit" to edit a Chef Info, the Image field look the same if I uploaded image already or not.
Here is my field:
$fieldset->addField('image_url', 'image', array(
'label' => Mage::helper('tressympa_cheflist')->__('Profile Picture'),
'required' => false,
'name' => 'image_url',
));
Any suggestion? Thank you very much!
Best Answer
save image name with your complete path.
save in database with
yourfolder/imagename.jpg
it will show automatically in edit form.
OR
you can rendered the field and show the image
add your file Block/Adminhtml/ModuleName/Renderer/Image.php