You are here

public function Webp::deleteImageStyleDerivatives in WebP 8

Deletes all image style derivatives.

File

src/Webp.php, line 158

Class

Webp
Class Webp.

Namespace

Drupal\webp

Code

public function deleteImageStyleDerivatives() {

  // Remove the styles directory and generated images.
  try {
    $this->fileSystem
      ->deleteRecursive(\Drupal::config('system.file')
      ->get('default_scheme') . '://styles');
  } catch (FileException $e) {
    $this->logger
      ->error($e
      ->getMessage());
    $error = $this
      ->t('Could not delete image style directory while uninstalling WebP. You have to delete it manually.');
    $this->logger
      ->error($error);
  }
}