Tag : incorrect-url

Magento – TinyMCE Image Uploader / Image incorrect URL

Small hack in file: app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
to correct image url from something like:

<img src="http://www.mysite.com//index.php/admin/cms_wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9Ii9jbGFzc2lmaWVkVUwuanBnIn19/key/f90eef374eaee0f5b76fc9783680c059/" />

into the correct image url.


public function getImageHtmlDeclaration($filename, $asIs = false)
{
$fileurl = $this->getCurrentUrl() . $filename;
$mediaPath = str_replace(Mage::getBaseUrl('media'), '', $fileurl);
$directive = sprintf('{{media url="%s"}}', $mediaPath);
$directive = $fileurl;
if ($asIs) {
$html = sprintf('', $directive);
} else {
$html = $directive;
// $directive = Mage::helper('core')->urlEncode($directive);
// $html = Mage::helper('adminhtml')->getUrl('*/cms_wysiwyg/directive', array('___directive' => $directive));
}
return $html;
}

Source: TinyMCE Image Uploader / Image inccorect URL