Created
January 25, 2014 15:42
-
-
Save xcommerce-gists/8618236 to your computer and use it in GitHub Desktop.
Sample Magento administrative image-only form element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom image form element that generates correct thumbnail image URL | |
* | |
* @author Magento | |
*/ | |
class Magentostudy_News_Block_Adminhtml_News_Edit_Form_Element_Image extends Varien_Data_Form_Element_Image | |
{ | |
/** | |
* Get image preview url | |
* | |
* @return string | |
*/ | |
protected function _getUrl() | |
{ | |
$url = false; | |
if ($this->getValue()) { | |
$url = Mage::helper('magentostudy_news/image')->getBaseUrl() . '/' . $this->getValue(); | |
} | |
return $url; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment