Description
I am getting hundreds of daily emails from different websites I manage with the error "
Unsupported image format."
The error is triggered every time a CMS page or block is edited in the admin
The root of the problem is the Gd2 adapter calling getimagesize() on an "http://" wrapper in an environment where allow_url_fopen is false (as it is for most shared hostings).
getimagesize() logs an error and returns false, then _fileType does not get set which leads to an exception in line 150 of Varien/Image/Adapter/Gd2.php
A possible solution mentioned in the forums is to download the image using cURL. But I don't think accessing the image via http:// makes sense for most cases, since the images are usually located in the media/wysiwyg/ directory within the server.
I tried changing Mage_Adminhtml_Cms_WysiwygController
to remove the URL part and it seems to work fine, but I'd have to make more tests.
$url = Mage::getModel('core/email_template_filter')->filter($directive); $url = str_replace(Mage::getBaseUrl('media'), '', $url); $url = Mage::getBaseDir('media') . DS . $url;