You are here

function image_style_warmer_crop_insert in Image Style Warmer 8

Implements hook_ENTITY_insert() for crop entity.

File

./image_style_warmer.module, line 53
ISW Module file creates image styles on image upload and via queue.

Code

function image_style_warmer_crop_insert(EntityInterface $entity) {
  if ($entity
    ->get('entity_type')->value == 'file') {
    if ($file = File::load($entity
      ->get('entity_id')->value)) {
      \Drupal::service('image_style_warmer.warmer')
        ->warmUp($file);
    }
  }
}