I'm trying to display thumbnail image in my custom admin module edit form like this
Right now I'm using this addfield
.
$fieldset->addField('main_image', 'image', array(
'label' => Mage::helper('ram')->__('Image'),
'required' => false,
'name' => 'main_image',
));
I looked at lib/Varien/Data/Form/Element/Image.php
and found this code which uses images url there.
public function getElementHtml()
{
$html = '';
if ((string)$this->getValue()) {
$url = $this->_getUrl();
if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) {
$url = Mage::getBaseUrl('media') . $url;
}
But I'm not storing images in media folder for this module. I'm uploading images from the controller in ram_images
folder.
$path = Mage::getBaseDir('media') . DS .'ram_images' ;
$uploader->save($path, $_FILES['main_image']['name'] );
Also, i could not change URL from Image.php
file as it will affect other system modules. is there any workaround here. Please suggest a solution.
And I also want to delete image using checkbox provided below upload button.
Thanks.