First off, all product data is being imported in to Magento. I know it's an issue that the images cache isn't created so after the import products show placeholder images and we can fix this by generating the images with:

php bin/magento catalog:images:resize

Yes, it takes a while, but it does the job and it seems to go faster the next time it's run.

But I want to import products on a schedule now and I can't run that command manually every day. I could add it to the cron I guess, something like:

0 * * * * /usr/bin/php /var/www/html/bin/magento catalog:images:resize > /var/www/html/var/log/images.cron.log

which would run the command every hour (and overwrite the log) but that seems really inefficient.

What I want to know is:

  1. Is there a way to run this command via an observer when, for example, a product import completes?


  1. Is there a way to hook in to the save product method and just generate the images I need for that product only?
  • Did you get any solution? I'm facing same problem in 2.4
    – shreyas d
    May 11 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.