You are here

public function PdfPreviewGenerator::deletePdfPreview in PDFPreview 2.0.x

Same name and namespace in other branches
  1. 8 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);
}