cancel
Showing results for 
Search instead for 
Did you mean: 

Image cache and image path from imports

Highlighted

Image cache and image path from imports

Specs:

Magento 2.3.2

Rapidflow extension for importing

 

Issue, defined product images do not generate cached images on the fly.  As such, new products display the fallback image and after image cache clear fallback images are shown across the board.  For both instances after running catalog:images:resize all images are properly cached and served on the front end.

 

What I have discovered is that images are defined in the import csvs as "/image.jpg" with a prefix slash.  All images in the database are referenced in the same way and not "/i/m/image.jpg" as seems to be standard Magento.

 

If I modify my imports to "image.jpg" with no leading slash, then run the import, images are referenced in the database as "/i/m/image.jpg" and cached images load on the fly on the front end, no catalog:resize needed.

 

So the questions are, why does the regen work to rebuild cache but the front end won't, unless its named /i/m/image pathing?  It seems like different behavior. 

Second, if I want to scratch the images from the db and rerun the import do I need to remove from any tables beyond catalog_product_entity_media_gallery and catalog_product_entity_media_gallery_value_to_entity?

4 REPLIES 4
Highlighted

Re: Image cache and image path from imports

Hi @JasonLed 

 

Try once the following command:

Memory size issue:
php -d memory_limit = -1 bin/magento catalog:images:resize

Execution time issue:
php -d max_execution_time = -1 bin/magento catalog:images:resize

Try once both together if you face memory issue and execution time issue.
php -d memory_limit = -1 max_execution_time = -1 bin/magento catalog:images:resize

It may help you to resolve issue.
If issue resolve, please click on 'Kudos' & Accept as Solution!

Highlighted

Re: Image cache and image path from imports

The following works for me without issue.

php bin/magento catalog:images:resize 

My issue is that if I delete all cache including image cache, every single product shows a fallback image and does not generate its cache counterpart for the actual image.  If I import a new product the image is properly copied to pub/media/catalog/product/image.jpg, but the front end displays the fallback only, never creates the cached version.  

In both situations if I run the resize command the cached counterparts are created and the frontend displays correctly.  The image resize command takes so long I don't want to have to depend on it for cleared cache and new products.

Highlighted

Re: Image cache and image path from imports

@JasonLed 

 

Why you are clearing catalog image cache? if you will clear catalog cache image you have to run again the command. You can clear cache inside of cache folder but cant clear media>cache>catalog>images.

 

This is how Magento works.

Manish Mittal
https://www.manishmittal.com/
Highlighted

Re: Image cache and image path from imports

I am not clearing image cache as a practice, but if it happens then every single product shows a fallback image until the catalog:resize command is run.  Thats not my issue and I understand this functionality.  With that said, even with clearing image cache, if I visit a product page after the image cache is supposed to build for that product on demand and that's not happening.  At least that's my understanding of the functionality.

 

Thats a portion of the issue, the greater issue is a new imported product does not show its image and the cached version is never created until I run the lengthy catalog:resize command.  I don't see anywhere that suggests that's normal behavior.