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

Wrong order of "width" x "height" when uploading image to admin under Content>Design Config #10124

Closed
mjoraid opened this issue Jul 3, 2017 · 6 comments
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@mjoraid
Copy link

mjoraid commented Jul 3, 2017

Preconditions

  1. Magento CE 2.1.7

Steps to reproduce

  1. Login to admin panel
  2. Go to: Content -> ("Design") Configuration -> a list of designs will show up in a table
  3. Hit "Edit" to one of the listed designs
  4. In Default Store View page, Expand the collapsible section titled "Header"
  5. Hit "Upload" and upload an image

Expected result

  1. To have the image uploaded
  2. Display image dimension underneath the image in pixels ordered Width first then Height

Actual result

  1. The image gets uploaded successfully
  2. The dimensions pixels show in reverse order. It displays Height x Width (it should be reversed order, Width first (width x height)

image


The issue is within the file "file-uploader.js" having width and height mixed up in wrong order.

Source File:
<magento root>/vendor/magento/module-ui/view/base/web/js/form/element/file-uploader.js

image

@alstenconsulting
Copy link

Exactly same problem on Magento CE 2.1.7.
I first tough that Logo Image Width and Height fields doesn't work at all because doesn't matter what number I set logo size doesn't change, but then reading this issue I used Width for Height and vise versa and it works.

How did you change the code? How it should be according to the image above?

Thanks,
Alex

@ihor-sviziev
Copy link
Contributor

@mjoraid I created Pull Request based on your investigation. I think it will be processed faster than this issue.

@mjoraid
Copy link
Author

mjoraid commented Jul 3, 2017

@alstenconsuilting to answer your question:

How did you change the code? How should it be according to the image above?

Go to this Javascript file:

<magento root>/vendor/magento/module-ui/view/base/web/js/form/element/file-uploader.js

and switch the order of the code at line 361 & 362.

Instead of height = width, make sure it's height = height and width = width. But in the code is that it's mixed up, it's set to width = height and height = width.

Wrong Code:

      file.previewWidth = img.naturalHeight;
      file.previewHeight = img.naturalWidth;

Correct Code:

       file.previewWidth = img.naturalWidth
       file.previewHeight = img.naturalHeight;

I'm still failry new to Github, but it seems @ihor-sviziev has made a pull request to add the code to the offical implementation.

@alstenconsulting
Copy link

@mjoraid .

Thank you. I changed code exactly as you described and it worked.

Thanks again,
Alex

@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog labels Jul 31, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-70419

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team
Copy link
Contributor

@mjoraid, thank you for your report.
The issue is already fixed in 2.2.0

@magento-engcom-team magento-engcom-team added 2.2.x Fixed in 2.2.x The issue has been fixed in 2.2 release line labels Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

6 participants