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:
- Is there a way to run this command via an observer when, for example, a product import completes?
- Is there a way to hook in to the save product method and just generate the images I need for that product only?