I am importing many many images (300,000+). This number includes adding different crops for each image.
I might be wrong, but it seems that to get Drupal to know that a crop style has been set, I need to load the crop style and then create an image derivative. Without creating a derivative, the crop will be set for a media item initially, but on cache flush the crop is lost (even though the physical file still exists)
$hero_crop = ImageStyle::load('hero'); $hero_crop->createDerivative($file->getFileUri(), "s3://$stylePath");
I should highlight that we are using the S3FS module to connect and store the images in S3 and I am really hoping that isn't the cause.
However, this takes forever while importing my images. So much so that if my batch script is set to process more than 1 at a time it will still timeout. That means that importing one image takes 15-30 seconds which means the import will take on average 1250 hours to complete.
So my question is, is there an alternative way of creating crop styles or does it need to be done with an image derivative?