-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Setting image keep frame to false in theme's view.xml does not work #4622
Comments
I can confirm the issue: Setting the value to "false" in Setting the value to "0" in Thanks @brendanmckeown for the workaround, it does work. |
Hi, @brendanmckeown! Thank you for reporting this issue. Internal ticket MAGETWO-53411 |
+1 |
This is still an issue months later, any update? |
@rgoncharuk Can you merge the pull request #7262 ? |
@brendanmckeown @markdavies @PascalBrouwers |
@brendanmckeown Before PR #7262 is live, do you have any idea why your fix works smoothly in dev mode, but not in production mode? |
@stianmartinsen I may have found the reason why... by correcting the boolean value for keepFrame, it exposed a bug in https://github.com/magento/magento2/blob/2.1/app/code/Magento/Catalog/Model/Product/Image/ParamsBuilder.php in which build() checks the frame parameter with the empty function $frame = !empty($imageArguments['frame'])
? $imageArguments['frame']
: $this->keepFrame; So although the images are being created correctly now, since ParamsBuilder is returning the incorrect parameters that are used for the MD5 cache directory hash, the url path returned to the frontend gallery is pointing to the wrong cache directory. This one was a frustrating bug to hunt down since it was giving the impression that the original problem fixed by PR #7262 was still occurring. I have no idea why empty() is being used to check the existence of the frame argument in |
[TSG] Fixes for 2.2 (pr109) (2.2.10-develop)
Steps to reproduce
<frame>false</frame>
to a specific image type as instructed in the docs: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-images.html . This image should also have awidth
andheight
setting andaspect_ratio
set to true. For example:Expected result
## Actual result 1. Image is forced to width and height with white frame, and does not keep original aspect ratio.
Cause:
The value from view.xml is passed to the method \Magento\Catalog\Model\Product\Image::setKeepFrame – which casts the string "false" to the boolean true. Therefore, it is not possible to set keep_frame to false from within the view.xml.
After creating a plugin to convert the string value to an integer (which properly casts to a boolean), the image frame is not added.
The text was updated successfully, but these errors were encountered: