-
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
Magento 2.3 images cache generation generates wrong hash for some images with a custom theme that has the keep_frame var set to 0 #19710
Comments
Hi @carolineboivin. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @carolineboivin do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
@magento-engcom-team give me 2.3.0 instance |
Hi @carolineboivin. Thank you for your request. I'm working on Magento 2.3.0 instance for you |
Hi @carolineboivin, here is your Magento instance. |
Seems to be a duplicate of #4622 after all |
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
Hi @carolineboivin thank you for you report. I'm trying reproduce this on clean magento instance but unsuccessful. Can you provide more detail, or maybe this related to some custom modules ? |
I could not reproduce on the provided vanilla Magento instance, since it happens when you have a custom theme with a view.xml file setting the "product_image_white_borders" to 0 and then regenerating the images with the CLI. |
@carolineboivin I was debugging on custom theme, and actually i set break point, and the value of product_image white borders always be set to 1, but in my config files it was 0. |
@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets |
@magento-engcom-teamI am using a custom theme and i have upgrade Magento version 2.2.6 to 2.3.0 then i am facing same issue. |
@carolineboivin did you get any solution for issue? |
Hi @navinbhudiya, I was able to fix my images with adding |
@carolineboivin You mean example this? I have still same issue after this.
|
Yes, I am using the swatches in the listing, so the most important format were not in my view.xml file at first, I copied the values from the module swatches too in my file, maybe you're missing those ?
|
I just upgraded from 2.2.6 to 2.3 and I am having the same issue. The product images are using the wrong hash. Has there been any official fix for this? Edit: |
I have the same issue with white borders and my changes in theme view.xml don't work. It helps me only if I create etc/view.xml in some module (this module has sequence on Magento_Catalog) with |
I have was same issue. So I restored back to 2.2.7 because this big issue. Hope so someone fix this issue for magento 2.3.0. |
Any new fixes for this? I upgraded from Magento 2.3.1 to 2.4.2 and in live environment all product images are only showing placeholder. Tried all solutions several times. EDIT: I finally found a "workaround" I can live with. Find the settings under store > settings > configuration > catalog media url format This is definitly a bug. |
Hello @johnny-longneck , Please update configure to: |
Hello, In my answer, I said this was already my workaround. |
Did you find any other solution? |
Same issue happened to our store when we migrated to Magento 2.4.2+ . After week of research we found the issue, Replace with return preg_replace('|^.*((?:/[^/]+){3})$|', '$1', $resizedImagePath); |
@VyacheslavCh did this resolve the issue totally for you? Using your option destroys also my category images, before it was just product images. Really frustrating. We are live with full sized catalog images for more than 4 weeks now. |
Hello, I reproduce it too on 2.4.2. I will try to PR a fix. |
Fix by @pauldonnelly , or simply running |
@carolineboivin @Nuranto Please follow comment #33439 (comment) If you still able reproduce issue on fresh 2.4-develop installation please provide step by step instruction |
I fixed a 2.2 by commenting out the first is_array of an or in Magento\Catalog\Model\Product;\Image::isCached() Does any one know what isCached means in this context? Does it mean the url/uri is a cached path? The hash will always be a hash since it includes the configurations. |
Why this comment has 1 like? because it asked for step by step and then closed this ticket. If we would not close tickets in this manner, we will have 100.000 bugs in Magento 2. @Den4ik why did you close this? Is everything ok? |
We resolved our issue on 2.4.3-p1 ( upgraded from 2.3.4 ) by patching the regex function in:
Our hash issue was resolved with a composer update (make sure your dependencies update) Images are now loading on our front-end. |
I also have issue however 2.4.3-p2, the above did not resolve my issue unfortunately. For me all my main store have correct images however secondary show placeholder for all generated images. Tried also changing to "query param" for "Catalog media URL format" as suggested earlier but will need to build that into the webserver or a CDN as just serves original files with params so careful of that one. |
I also had the same issue on 2.4.3-p1, the image cache URL's were generated wrong. For me it was a wrong Watermark configuration, removing these settings all the cache images were generated right again. Maybe this will help someone. |
@pimruiter Thanks...!!! Watermark configuration was causing issues for me in GraphQL images for cart data and products. Currently removing Watermarks images fixes my issue. Any idea why it's causing it? |
My issue was that the resizer doesn't work for products set to not visible individually. |
This is for EE ? |
After a lot of debugging , I found that .htaccess was changed in pub/media ( this file is very import because each not found image forwarded to pub/get.php to generate the cache image immediately if its not found on the cache , so i just restored the .htaccess file and my problem was solved . if your problem still not solved you have to make sure that the get.php is called so you can add echo "test image"; exit; At the beginning of the file after this open any not found image on the frontend ; if get.php was called correctly the output must be "test image" if not then you problem is get.php is not called. Please note that if the imges still not appear and get.php called correctly you can debug get.php and add a echo test on each step to find what exactly is the problem , maybe its a permissions issue. |
@mdiab1996 |
This issue still exists in M 2.4.6 The workaround is to explicitly specify |
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.
The text was updated successfully, but these errors were encountered: