Skip to content

GD2 not working in WYSIWYG #246

Closed
Closed
@barbazul

Description

@barbazul

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;


Metadata

Metadata

Assignees

Labels

Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions