Reputation: 138
I am developing an extension and want to display images on extension backend page. I have stored images in 'images' folder in my extension.
I am trying to show images using <img>
tag. I have provided image url in "src" attribute, but its not showing image at the backend page.
In system.xml
, I am using following code:-
<myOption translate="label">
<label>My Label</label>
<frontend_type>radios</frontend_type>
<source_model>mymodule/source_buttons</source_model>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</myOption>
Code in Model\Source\Buttons.php
file:-
<?php
class mycompany_mymodule_Model_Source_Buttons
{
public function toOptionArray()
{
$result = array();
$result[] = array('value' => '32', 'label'=>'<img src="'.Mage::getModuleDir('', 'mycompany_mymodule').DS.'Skin'.DS.'Images'.DS.'img32.png" />');
$result[] = array('value' => '16', 'label'=>'<img src="'.Mage::getModuleDir('', 'mycompany_mymodule').DS.'Skin'.DS.'Images'.DS.'img16.png" />');
return $result;
}
}
On the extension backend page, its showing:-
<img src="C:\wamp\www\magento\app\code\community\mycompany\mymodule\Skin\Images\img32.png">
But the src
attribute value is linking to :-
http://mydomain/magento/index.php/admin/system_config/edit/section/mymodule_options/key/b834efa05ef37070c94d28c6b44e4bf0/C:/wamp/www/magento/app/code/community/mycompany/mymodule/Skin/Images/img32.png
Please help...
Upvotes: 1
Views: 397
Reputation: 3158
try this:
echo $this->getSkinUrl();
you can get a path to your images.
Upvotes: 2