{"id":131,"date":"2010-11-15T09:05:30","date_gmt":"2010-11-15T14:05:30","guid":{"rendered":"http:\/\/www.g31zone.com\/?p=131"},"modified":"2010-11-15T09:09:51","modified_gmt":"2010-11-15T14:09:51","slug":"magento-tinymce-image-uploader-image-incorrect-url","status":"publish","type":"post","link":"https:\/\/www.g31zone.com\/?p=131","title":{"rendered":"Magento &#8211; TinyMCE Image Uploader \/ Image incorrect URL"},"content":{"rendered":"<p>Small hack in file: app\/code\/core\/Mage\/Cms\/Helper\/Wysiwyg\/Images.php<br \/>\nto correct image url from something like: <\/p>\n<p><code>&lt;img src=\"http:\/\/www.mysite.com\/\/index.php\/admin\/cms_wysiwyg\/directive\/___directive\/e3ttZWRpYSB1cmw9Ii9jbGFzc2lmaWVkVUwuanBnIn19\/key\/f90eef374eaee0f5b76fc9783680c059\/\" \/&gt;<br \/>\n<\/code><\/p>\n<p>into the correct image url.<\/p>\n<p><code><br \/>\npublic function getImageHtmlDeclaration($filename, $asIs = false)<br \/>\n{<br \/>\n$fileurl = $this->getCurrentUrl() . $filename;<br \/>\n$mediaPath = str_replace(Mage::getBaseUrl('media'), '', $fileurl);<br \/>\n$directive = sprintf('{{media url=\"%s\"}}', $mediaPath);<br \/>\n$directive = $fileurl;<br \/>\nif ($asIs) {<br \/>\n$html = sprintf('<img decoding=\"async\" src=\"%s\" alt=\"\" \/>', $directive);<br \/>\n} else {<br \/>\n$html = $directive;<br \/>\n\/\/ $directive = Mage::helper('core')->urlEncode($directive);<br \/>\n\/\/ $html = Mage::helper('adminhtml')->getUrl('*\/cms_wysiwyg\/directive', array('___directive' => $directive));<br \/>\n}<br \/>\nreturn $html;<br \/>\n}<br \/>\n<\/code><\/p>\n<p>Source: <a href=\"http:\/\/www.magentocommerce.com\/bug-tracking\/issue\/?issue=8655\" rel=\"nofollow\" target=\"_blank\">TinyMCE Image Uploader \/ Image inccorect URL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Small hack in file: app\/code\/core\/Mage\/Cms\/Helper\/Wysiwyg\/Images.php to correct image url from something like: &lt;img src=&#8221;http:\/\/www.mysite.com\/\/index.php\/admin\/cms_wysiwyg\/directive\/___directive\/e3ttZWRpYSB1cmw9Ii9jbGFzc2lmaWVkVUwuanBnIn19\/key\/f90eef374eaee0f5b76fc9783680c059\/&#8221; \/&gt; into the correct image url. public function getImageHtmlDeclaration($filename, $asIs =&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[170],"tags":[41,42,5,40],"class_list":["post-131","post","type-post","status-publish","format-standard","hentry","category-magento","tag-image-uploader","tag-incorrect-url","tag-magento","tag-tinymce"],"_links":{"self":[{"href":"https:\/\/www.g31zone.com\/index.php?rest_route=\/wp\/v2\/posts\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.g31zone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.g31zone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.g31zone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.g31zone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=131"}],"version-history":[{"count":6,"href":"https:\/\/www.g31zone.com\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":137,"href":"https:\/\/www.g31zone.com\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions\/137"}],"wp:attachment":[{"href":"https:\/\/www.g31zone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.g31zone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.g31zone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}