Magento News

 

Getting Broken link on frontend for image uploaded via Wysiwyg editor in a custom module !!!

M getting this :

<img alt="" }}="" es_3.jpg="" wysiwyg="" src="{{media url=">

In my form i added this code

$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(

     array('tab_id' => 'form_section')

);

$wysiwygConfig["files_browser_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index');

$wysiwygConfig["directives_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');

$wysiwygConfig["directives_url_quoted"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');

$wysiwygConfig["widget_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/widget/index');

$wysiwygConfig["files_browser_window_width"] = (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_width');

$wysiwygConfig["files_browser_window_height"] = (int) Mage::getConfig()->getNode('adminhtml/cms/browser/window_height');

$plugins = $wysiwygConfig->getData("plugins");

$plugins[0]["options"]["url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin');

$plugins[0]["options"]["onclick"]["subject"] = "MagentovariablePlugin.loadChooser('".Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_variable/wysiwygPlugin')."', '{{html_id}}');";

$plugins = $wysiwygConfig->setData("plugins",$plugins);

  $fieldset->addField('longdescription', 'editor', array(

      'name'      => 'longdescription',

      'label'     => Mage::helper('press')->__('Description'),

      'title'     => Mage::helper('press')->__('Description'),

      'style'     => 'width:500px; height:300px;',

      'config'    => $wysiwygConfig,

    ));

I m still not clear about the above code but i copied it from somewhere,But i do know that it enables to browse for images files instead of writing custom url.

After that i just call it in frontend like this:

<?php echo $item["longdescription"]; ?>

I am getting the text , but not the image and for image i am getting the broken link mentioned at top.

Am i missing something ?? if yes then what ?

Getting Broken link on frontend for image uploaded via Wysiwyg editor in a custom module !!!

Possibly Related Posts:


 

Leave a Reply