Skip to content

Extra generated cache images when a product is saved in admin #10363

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

Closed
miquelcoma opened this issue Jul 28, 2017 · 13 comments
Closed

Extra generated cache images when a product is saved in admin #10363

miquelcoma opened this issue Jul 28, 2017 · 13 comments
Labels
Component: Cache Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release

Comments

@miquelcoma
Copy link

miquelcoma commented Jul 28, 2017

When saving a product in admin, extra images are generated in pub/media/catalog/product/cache.

the sizes are coming from the view.xml file defined in the luma and blank themes in the vendor core folder.

Preconditions

  1. A custom theme with a custom image sizes defined in the view.xml file.
  2. Magento 2.1.7 C.E., in development or production mode.
  3. Running in ngingx with php 7.0.

Steps to reproduce

  1. Have a look at pub/media/catalog/product/cache
  2. Go to admin
  3. Go to Product -> Catalog -> select an article.
  4. Save the product (is not necessary any modification)
  5. Have a look again to the cache folder.

Expected result

  1. In the cache image folder, only the image sizes defined in our custom theme view.xml file exists plus the sizes defined in magento backend theme view.xml file.

Actual result

  1. In the images cache folder appears extra images that have no relation with our theme or magento backend theme etc/view.xml file.
  2. Those extra sizes are coming from the view.xml file defined in the luma and blank themes in the vendor core folder.

How I can avoid those extra images generated in the cache folder?

@orlangur
Copy link
Contributor

Looks like #3650 is related to me. Some workarounds are available in comments there.

@hostep
Copy link
Contributor

hostep commented Jul 30, 2017

This is more a duplicate of #8145, although being able to remove/disable a theme should probably also work around this issue.
There is also a closed PR which you can maybe turn into a module which should solve this problem (haven't tested this for a couple of months, so no idea if this is still relevant for the latest Magento version): #8142

@miquelcoma
Copy link
Author

miquelcoma commented Jul 31, 2017

Thanks @orlangur and @hostep,

I have tested the proposed solution from @vrann and works fine!

I have created a temporary module (waiting for the next update of magento 2.x) that implements the fix without changing anything in the vendor core folder:

di.xml:

<preference for="Magento\Catalog\Model\Product\Image\Cache" type="VENDOR\MagentoFix\Model\Product\Image\Cache"/>

app\code\VENDOR\MagentoFix\Model\Product\Image\Cache.php:

With the contents of: @vrann fix

with the namespace changed to VENDOR.

@magento-engcom-team magento-engcom-team added G1 Passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 29, 2017
@magento-engcom-team
Copy link
Contributor

@miquelcoma, thank you for your report.
We've created internal ticket(s) MAGETWO-80436 to track progress on the issue.

@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 1, 2017
@denisristic
Copy link
Contributor

I'm working on it #SQUASHTOBERFEST

denisristic referenced this issue in denisristic/magento2 Oct 16, 2017
…2abcedbe2e67996b043041b48) + added check for used themes in products, categories and cms pages)

REF magento2/issues#10363

UnitTests are failing due to mocking problems:
```
1) Magento\Catalog\Test\Unit\Model\Product\Image\CacheTest::testGenerate
Error: Call to a member function getId() on null
``
@prestashoppay
Copy link

@vrann ,

I am using magento 2.1.6 version , in my admin panel having images on each and every products , but frontend image path didn't created a folder '"cache/f073062f50e48eb0f0998593e568d857" ..

Please give a solutions .

@teoteo
Copy link

teoteo commented Mar 31, 2018

Waiting for the official fix, do you have suggestions to identify which are the unused cache folders so I can delete it?

@faisalmirza
Copy link

Hi was wondering if is there is an update on this?

@engcom-Bravo engcom-Bravo removed the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Jan 6, 2020
@engcom-Bravo engcom-Bravo added Component: Cache Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Jan 6, 2020
@engcom-Bravo engcom-Bravo self-assigned this Jan 6, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jan 6, 2020

Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Bravo engcom-Bravo added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Jan 6, 2020
@ghost ghost unassigned engcom-Bravo Jan 6, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-30227 were created

Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch and removed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Apr 21, 2020
@magento-engcom-team
Copy link
Contributor

Hi @miquelcoma.

Thank you for your report and collaboration!

The related internal Jira ticket MC-33501 was closed as non-reproducible in 2.3-develop.
It means that Magento team either unable to reproduce this issue using provided Steps to Reproduce from the Description section on clean Magento instance or the issue has been already fixed in the scope of other tasks.

But if you still run into this problem please update or provide additional information/steps/preconditions in the Description section and reopen this issue.

@magento-engcom-team magento-engcom-team removed the Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch label Apr 21, 2020
@magento-engcom-team
Copy link
Contributor

Hi @miquelcoma.

Thank you for your report and collaboration!

The related internal Jira ticket MC-30227 was closed as non-reproducible in 2.4-develop.
It means that Magento team either unable to reproduce this issue using provided Steps to Reproduce from the Description section on clean Magento instance or the issue has been already fixed in the scope of other tasks.

But if you still run into this problem please update or provide additional information/steps/preconditions in the Description section and reopen this issue.

@ArtemVasyliev
Copy link
Contributor

I was not able to reproduce the issue according to provided steps.
find pub/media/catalog/product/cache -type f -exec sha1sum {} ; | sort did not show any duplicate files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Cache Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release
Projects
None yet
Development

No branches or pull requests