-
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
Regression bug in Magento 2.1.6 - hidden images used on the product listing never get generated #9498
Comments
For me bin/magento catalog:images:resize - required almost 3 hours of time frame. At the time of final migration before launching - how could we wait for 3 hours? This issue must be resolved immediately |
@ravibhalodia: you are talking about #9275 or #9276, this ticket isn't about that. |
Pretty urgent yeah - any hack we can do make it work for now? |
I posted a workaround in the original thread, let me copy it here, since it makes more sense to have it here: diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php
index 6cfa90a7c4c..54872986fe2 100644
--- a/app/code/Magento/Catalog/Model/Product.php
+++ b/app/code/Magento/Catalog/Model/Product.php
@@ -1461,13 +1461,13 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
*
* @return \Magento\Framework\Data\Collection
*/
- public function getMediaGalleryImages()
+ public function getMediaGalleryImages($includeDisabledImages = false)
{
$directory = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA);
if (!$this->hasData('media_gallery_images') && is_array($this->getMediaGallery('images'))) {
$images = $this->_collectionFactory->create();
foreach ($this->getMediaGallery('images') as $image) {
- if ((isset($image['disabled']) && $image['disabled']) || empty($image['value_id'])) {
+ if ((isset($image['disabled']) && $image['disabled'] && !$includeDisabledImages) || empty($image['value_id'])) {
continue;
}
$image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']);
diff --git a/app/code/Magento/Catalog/Model/Product/Image/Cache.php b/app/code/Magento/Catalog/Model/Product/Image/Cache.php
index 2a5316583ff..4f0bbbfa0e9 100644
--- a/app/code/Magento/Catalog/Model/Product/Image/Cache.php
+++ b/app/code/Magento/Catalog/Model/Product/Image/Cache.php
@@ -81,7 +81,7 @@ class Cache
*/
public function generate(Product $product)
{
- $galleryImages = $product->getMediaGalleryImages();
+ $galleryImages = $product->getMediaGalleryImages(true);
if ($galleryImages) {
foreach ($galleryImages as $image) {
foreach ($this->getData() as $imageData) { Disclaimer: not tested thoroughly! |
Thanks Pieter!
…On 10 May 2017 01:53, "Pieter Hoste" ***@***.***> wrote:
I posted a workaround in the original thread, let me copy it here, since
it makes more sense to have it here:
diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php
index 6cfa90a7c4c..54872986fe2 100644--- a/app/code/Magento/Catalog/Model/Product.php+++ b/app/code/Magento/Catalog/Model/Product.php@@ -1461,13 +1461,13 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
*
* @return \Magento\Framework\Data\Collection
*/- public function getMediaGalleryImages()+ public function getMediaGalleryImages($includeDisabledImages = false)
{
$directory = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA);
if (!$this->hasData('media_gallery_images') && is_array($this->getMediaGallery('images'))) {
$images = $this->_collectionFactory->create();
foreach ($this->getMediaGallery('images') as $image) {- if ((isset($image['disabled']) && $image['disabled']) || empty($image['value_id'])) {+ if ((isset($image['disabled']) && $image['disabled'] && !$includeDisabledImages) || empty($image['value_id'])) {
continue;
}
$image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']);diff --git a/app/code/Magento/Catalog/Model/Product/Image/Cache.php b/app/code/Magento/Catalog/Model/Product/Image/Cache.php
index 2a5316583ff..4f0bbbfa0e9 100644--- a/app/code/Magento/Catalog/Model/Product/Image/Cache.php+++ b/app/code/Magento/Catalog/Model/Product/Image/Cache.php@@ -81,7 +81,7 @@ class Cache
*/
public function generate(Product $product)
{- $galleryImages = $product->getMediaGalleryImages();+ $galleryImages = $product->getMediaGalleryImages(true);
if ($galleryImages) {
foreach ($galleryImages as $image) {
foreach ($this->getData() as $imageData) {
Disclaimer: not tested thoroughly!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#9498 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4ypoRhrQYlwT7KGQSVf_8aHDqxtgURks5r4KgJgaJpZM4NPzre>
.
|
I'm having the same issue in 2.1.6. Any news about this yet? Does this fix work? |
Experiencing this same problem. Upgraded from 2.1.5 to 2.1.6 and when we click the flush images button in System > Cache Management the pub/media/catalog/product/cache folder is deleted and not re-generated. Thus images disappear. The bin/magento catalog:images:resize command fixes the issue. Although takes an age to run on our 4000 products in this particular store! So by no means a solution. Proper fix in next version of Magento2 would be great. |
Was this an actual decision by the Magento2 team? (Edit: Yes, it's in the updated changelog.) It was deliberate? Is this permanent? On-the-fly image generation is the only method that will scale for any large store. My store has We can't seriously be expected to run that fickle command ( Edit: The latest run died about an hour and a half in. How is anyone expected to resolve a cryptic, "Unsupported image format," message? How is this useful? How is anyone expected to resolve this? Major work needs to be done. |
I'm working on the same store as @danemacmillan ( This modification revealed another issue. The This appears to be related to the The |
Magento just released 2.1.7 with a "reversion of the changes to image resizing that we introduced in 2.1.6": http://devdocs.magento.com/guides/v2.1/release-notes/ReleaseNotes2.1.7CE.html Can you please check if the original problem (not the performance issue, I guess) is gone in 2.1.7? Thanks! |
hi @hostep, thank you for reporting this issue, ticket MAGETWO-69570 is created for it. |
Verified that changes to image resizing that have been introduced in 2.1.6 fixed the issue, that's why I'm closing the issue. |
@KrystynaKabannyk: Why are you closing this issue? I can't see any commits referring MAGETWO-69570? I know it has been fixed in Magento 2.1.7 by reverting the new image resizing logic, but this doesn't mean the bug is fixed on the develop branch? Or are you reverting the image resizing logic over there as well? I also don't understand your comment, you are saying 2.1.6 fixed the issue but that's completely incorrect, because the bug was actually introduced in 2.1.6... |
This was originally reported by @airdrumz in #9276, but I think this problem deserves its own issue, otherwise it is going to get ignored.
Preconditions
Steps to reproduce
Expected result
Actual result
Discussion
This started happening after the decision to no longer generate resized images on the fly on the frontend in Magento 2.1.6. Images are now only being resized when a product is saved in the backend or by running the
bin/magento catalog:images:resize
command.Both of these can't fix this problem, so you are stuck with this problem.
There is a way to work around it, and that is to unhide the image, save the product, then hide it again. Then the resized image will be generated. But you can't expect shopowners to do this manually for thousands of products?
I think this is a pretty urgent bug, and should be fixed in the next minor release.
The text was updated successfully, but these errors were encountered: