Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD2 not working in WYSIWYG #246

Closed
barbazul opened this issue Feb 22, 2013 · 8 comments
Closed

GD2 not working in WYSIWYG #246

barbazul opened this issue Feb 22, 2013 · 8 comments
Assignees
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed

Comments

@barbazul
Copy link
Contributor

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;


@barbazul
Copy link
Contributor Author

barbazul commented Mar 6, 2013

After almost 2 weeks I can confirm the errors stopped and the WYSIWYG is working as expected (it wasn't before this fix)

I can go ahead and convert this into a pull request but it feels way too hacky for me.

Maybe I could add a check for allow_url_fopen ?

Is there any valid case that I am not considering where the image won't be available in the local filesystem and therefore it would make sense work around allow_url_fopen using cURL?

@verklov
Copy link
Contributor

verklov commented Jan 2, 2014

@barbazul , since we usually consider images as those stored on the server, are you talking about images stored somewhere on external resources? We are trying to understand the case that would require handling images in the way you suggest. Could you please provide a real life example?

@barbazul
Copy link
Contributor Author

barbazul commented Jan 4, 2014

@verklov The code is handling images as external resources even when that is not the case. That is my point, it usually isn't the case. The most logical way to handle local files is to open them using the filesystem and not an external URL, that's why I am replacing the BaseUrl for the BaseDir.

@verklov
Copy link
Contributor

verklov commented Feb 19, 2014

@barbazul , the team will investigate on this issue. We will update you once the analysis is complete.

@verklov verklov self-assigned this Feb 19, 2014
@greggh
Copy link

greggh commented Feb 27, 2014

I had to apply this fix to get the wysiwyg working. It is now working as expected.

@verklov
Copy link
Contributor

verklov commented Apr 1, 2014

@barbazul, the team reported that this issue refers to Magento 1.x rather than Magento 2. If this is true, please report this issue to the Magento 1.x bug tracker (http://www.magentocommerce.com/bug-tracking). Make sure you are logged in to magentocommerce.com prior to following the URL in brackets.
Please close this issue as not relevant to M2. Thank you!

@verklov
Copy link
Contributor

verklov commented Apr 15, 2014

We are closing this issue as not relevant for Magento 2. Please report the issue you have found to the Magento 1 bug tracker.
Thank you!

@verklov verklov closed this as completed Apr 15, 2014
tang-yu pushed a commit that referenced this issue Apr 24, 2015
[FearlessKiwis] Added Bundle Product to Catalog Product Data Object
tang-yu pushed a commit that referenced this issue Dec 20, 2015
@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Jun 23, 2020
@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed
Projects
None yet
Development

No branches or pull requests

4 participants