Questions tagged «varien-file-uploader»

3
在自定义模块管理表单中显示缩略图和删除图像
我正试图在这样的自定义管理模块编辑表单中显示缩略图, 现在我正在使用它addfield。 $fieldset->addField('main_image', 'image', array( 'label' => Mage::helper('ram')->__('Image'), 'required' => false, 'name' => 'main_image', )); 我看了一下lib/Varien/Data/Form/Element/Image.php,发现此代码在那里使用图像url。 public function getElementHtml() { $html = ''; if ((string)$this->getValue()) { $url = $this->_getUrl(); if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) { $url = Mage::getBaseUrl('media') . $url; } 但是我没有将图像存储在该模块的媒体文件夹中。我正在从ram_images文件夹中的控制器上传图像。 $path = Mage::getBaseDir('media') . DS .'ram_images' ; $uploader->save($path, $_FILES['main_image']['name'] …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.