-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Summary (*)
I just upgrade my Magento 2 project from 2.2.6 to 2.3. After the upgrade, some images in the catalog are showing placeholders instead of the images. I have regenerated the images cache with the catalog:images:resize but some images are still missing (swatch images in category pages and image thumbnail in category pages).
After some investigation, it seems that is it a problem with the hash used for the image cache directory. When generating the images cache in the CLI, all images have in their misc params used to build the hash a value of "keep_frame" => 1, although in the view.xml file of my custom theme, the param "product_image_white_borders" is set to 0. When generating the image path for the catalog pages, the keep frame param is 0.
My investigation led me to the ParamsBuilder class (module-catalog/Model/Product/Image/ParamsBuilder) that uses its viewConfig property to get the value of the var "product_image_white_borders" in the "hasDefaultFrame" function. Seemingly, when running the CLI command, the view config that is injected in the ParamsBuilder is not the same that is used by the ImageResize command, and it has a wrong "product_image_white_borders" value of 1. It seems that it does not use the theme that the ImageResize command is currently processing, and its scope is global.
Environment
Magento 2.3 Open Source with custom frontend theme
Examples (*)
Assign images to products in the catalog.
Set the value of the variable "product_image_white_borders" to 0 in your custom theme view.xml file.
Regenerate product images cache with the CLI command catalog:images:resize.
Proposed solution
The product thumbnail in category pages should appear but instead the placeholder image is shown.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status