You are here

public function PDFPreviewGenerator::deletePDFPreview in PDFPreview 8

Same name and namespace in other branches
  1. 2.0.x src/PdfPreviewGenerator.php \Drupal\pdfpreview\PdfPreviewGenerator::deletePdfPreview()

Deletes the preview image for a file.

Parameters

\Drupal\file\Entity\File $file: The file to delete the preview for.

2 calls to PDFPreviewGenerator::deletePDFPreview()
PDFPreviewGenerator::getPDFPreview in src/PDFPreviewGenerator.php
Gets the preview image if it exists, or creates it if it doesnt.
PDFPreviewGenerator::updatePDFPreview in src/PDFPreviewGenerator.php
Deletes the preview image for a file when the file is updated.

File

src/PDFPreviewGenerator.php, line 105

Class

PDFPreviewGenerator
Generates PDF Previews.

Namespace

Drupal\pdfpreview

Code

public function deletePDFPreview(File $file) {
  $uri = $this
    ->getDestinationURI($file);
  $this->fileSystem
    ->delete($uri);
  image_path_flush($uri);
}