I have a local demo website which is protected by a .htaccess to showcase to the customer. Anyways, in this installation the image preview in the CMS WYSIWYG editor is not working.

In the system.log there is an entry:

ERR (3): Warning: getimagesize(http://example.com/skin/adminhtml/default/
  failed to open stream: 
  HTTP request failed! HTTP/1.1 401 Authorization Required
  in /var/www/public/lib/Varien/Image/Adapter/Gd2.php on line 71

Magento makes HTTP access to fetch the included images from the webserver - even if it might be the same server.

The solution is to allow the local host to access itself without password. In Apache this would be:

Require valid-user
Allow from
Satisfy Any
| improve this answer | |

Rewrite Mage_Adminhtml_Cms_WysiwygController controller and replace the code below in the directiveAction method:

$url = Mage::getModel('core/email_template_filter')->filter($directive);


$url = str_replace(Mage::getBaseUrl('media'), Mage::getBaseDir('media') . DS, $url);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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