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

Fixes black background for png images in wysiwyg editors #16733

Merged

Conversation

eduard13
Copy link
Contributor

@eduard13 eduard13 commented Jul 12, 2018

Description

This PR fixes the black background for png images, which are uploaded in wysiwyg editors. This issue appears only for GD2 image processing library.

Fixed Issues (if relevant)

  1. Transparent background becomes black for thumbnails of PNG into Wysiwyg editor... #14248: Transparent background becomes black for thumbnails of PNG into Wysiwyg editor

Manual testing scenarios

  1. Upload a png image from any wysiwyg editor
  2. The background while previewing of this image should be transparent.
    61eb1dd578

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team magento-engcom-team added Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jul 12, 2018
@magento-engcom-team
Copy link
Contributor

Hi @eduard13. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@osrecio osrecio self-assigned this Jul 12, 2018
@rogyar
Copy link
Contributor

rogyar commented Jul 12, 2018

It looks like we should perform a check that $this->_imageHandler is not bool|null before passing it to $this->_fillBackgroundColor. That's the exact reason why we have unit tests failing here (it's a sort of unit-integration test :) )

@eduard13
Copy link
Contributor Author

Thank you a lot @rogyar for the suggestion.

@osrecio
Copy link
Member

osrecio commented Jul 18, 2018

@eduard13 Can you check the errors in Travis?

@eduard13
Copy link
Contributor Author

eduard13 commented Jul 18, 2018

@osrecio looks like this issue is caused by declaring strict types.

Do you think is it ok, if we set 1 in order to pass an int value?
Or is better to remove strict_types declaration? Looks like because of the strict type, instead of int value, receives a bool one.
Or maybe you have some other suggestions here?

https://github.com/eduard13/magento2/blob/48607aa5dcb308a27994f35aaf330e631d9a0c8b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php#L184-L185

Thank you.

/**
* Keep the transparency for the images in the wysiwyg editors
*/
const KEEP_TRANSPARENCY = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need constant fir true value in this class, just assign true to property when it needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it, thanks.

@magento-engcom-team magento-engcom-team added this to the Release: 2.2.7 milestone Aug 22, 2018
@magento-engcom-team
Copy link
Contributor

Hi @osrecio, thank you for the review.
ENGCOM-2855 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @eduard13. Thank you for your contribution.
We will aim to release these changes as part of 2.2.7.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Framework/Image Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants