-
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
php bin/magento catalog:images:resize does not process hidden images. #28239
Comments
Hi @gwharton. 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:
For more details, please, review the Magento Contributor Assistant documentation. @gwharton do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
I have also mentioned this issue as #28182 |
Note, this behaviour was introduced in commit 048a2ee |
Hi @engcom-Delta. Thank you for working on this issue.
|
Looks like the change was made on purpose as an optimisation. |
HI @gwharton could you provide case where we can reuse same hidden image? Image uploaded for product cannot be used by media gallery and same image uploaded for another product has new name in database (name + increment index) |
@engcom-Delta I have a separate custom written module that uploads product data to Google Shopping and Google My Business. I need to use different product images for Google feeds than on my front end, so when I create a product I upload two images, one for front end, and one hidden one for Google. My module then picks up this hidden image url and uses that on the google feeds. The setting in Magento is named "Hide from Product Page", so seems like the perfect setting for me. And infact, it is the way that Magento works when you initially upload an image for a product. Setting it to hidden on the catalog page, DOES generate the cached images for it, regardless of its hidden state. The cached images only dissapear when you clear image cache and then regenerate using catalog:images:resize. There is an inconsistency there. If this isn't going to be fixed for catalog:images:resize, then Magento should be changed so that it does not generate cached images for new hidden images when they are uploaded to make it consistent, i.e cached images are not generated for hidden images, and the setting should also be changed on the frontend to "Disabled" instead of "Hidden from product page" to reflect the actual setting that is applied. |
In my module I call
where The url returned by this call returns a 404, when the image is "Hidden from product page" as the cached images were not processed by catalog:images:resize after an images cache clear. |
Perhaps there should be 2 settings, "hidden" and "disabled" |
Due to this cart and wishlist page shows placeholder images if small/thumbnail image is set to Hide from Product page. |
You can manually apply a patch as a workaround.
patches/composer/imageresizeall.diff
composer.json
Works on 2.3.5-p1 |
Perhaps a compromise would be a command line argument --process-hidden-images with the default to not process hidden images?? |
The wording "Hide from Product Page" implies the setting will only hide the image from the product page, but allowing the image to be used on the category listing page, wish list, compare, basket, any other use that is not product page... The original behaviour of only suppressing display of the image in the product page gallery is in line with the wording. The optimisation of not generating images when "Hide from Product Page" is checked differs from the original intended purpose, which is clearly to stop supporting product images from displaying in the product page image gallery. Many thanks to @gwharton for your patch, this works perfectly and allows the setting "Hide from Product Page" to be used as originally conceived. |
The catalog:images:resize routine seems to have been butchered a bit lately, but the way I see it, there are two recent changes that would have been better suited to command line arguments to make them optional, than making it work the same for everyone. --skip-hidden-images = Do not process images marked as hidden from product page Lets hope that because this went to dev in progress a few weeks ago, that someone from core are on it. |
@magento I am working on this |
Hi @BogdanGorbach! 👋 |
@magento add to contributors team |
Hi @BogdanGorbach! 👋 |
@magento I am working on this |
- added new options --skip-hidden-images - added new unit test
- Fixed Unit Test - Removed unnecessary dependency in the constructor
- Fixed Unit Test
Hi @gwharton. Thank you for your report.
The fix will be available with the upcoming 2.4.3 release. |
In General fixes add description for magento/magento2#28239 PR magento/magento2#33452
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Images that are hidden from the product page are not processed by the image resize command. They should be. Just because they are hidden from the product page, doesn't mean they won't be used elsewhere.
Magento is written so that hiding the product image, actually sets it to disabled.
IMHO setting a product image to disabled, and setting it to be hidden on product page are two very different settings, but magento currently treats them as the same.
The confusion stems from the hidden setting being stored in the database as the field disabled. A hidden image is NOT a disabled image, and should still be processed, just not displayed on the product page, otherwise, what is the point of the hidden setting?
Additional Information
#28239 (comment)
The text was updated successfully, but these errors were encountered: