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

Created on 3 Jul 2017  路  6Comments  路  Source: magento/magento2


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

Catalog Fixed in 2.2.x Format is valid Ready for Work bug report

All 6 comments

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

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

@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.

@mjoraid .

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

Thanks again,
Alex

Internal ticket to track issue progress: MAGETWO-70419

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

Was this page helpful?
0 / 5 - 0 ratings