Broken images

I noticed in the Magento CMS editor TinyMCE, the image thumbnails are set as the following format after a base64 encode of the shortcode {{media url="wysiwyg/foobar.gif"}}


This is happening on nginx and not on apache. Perhaps it's an environmental issue however my question aims to solve this on the Magento layer.


My question is, how does Magento decode this ___directive... URL? and where?

1 Answer 1


The code for building these types of links appears to be done in getImageHtmlDeclaration function in the file /app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php

$html = Mage::helper('adminhtml')->getUrl('*/cms_wysiwyg/directive', array('___directive' => $directive));

The code for displaying these images is in the file /app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php

public function directiveAction

Here is loads the parameter, urlDecodes it using the core helper, uses the email template to produce the real url to the image.

I would suggest to look into file /lib/Varien/Filter/Template.php as this has the function filter which appears to be where the final url change happens. This will take the image in format:

{{skin url='images/home_main_callout.jpg'}}

And convert to a real url format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.