From 58d4f260da95b0b80650077fef22cb3f00861a11 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sun, 31 Oct 2021 15:04:00 +0100 Subject: [PATCH] Fixed: unline file after getting pdf filesize --- compressors/PdfCompressor.php | 2 +- compressors/PngCompressor.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compressors/PdfCompressor.php b/compressors/PdfCompressor.php index 726b7da..41bc23a 100644 --- a/compressors/PdfCompressor.php +++ b/compressors/PdfCompressor.php @@ -50,7 +50,7 @@ class PdfCompressor extends Compressor { $filename = $this->extractImage($this->media->root()); $size = getimagesize($filename); - @unlink($file); + unlink($filename); return $size; } diff --git a/compressors/PngCompressor.php b/compressors/PngCompressor.php index c41880e..a185926 100644 --- a/compressors/PngCompressor.php +++ b/compressors/PngCompressor.php @@ -20,7 +20,7 @@ class PngCompressor extends Compressor { public function make(string $path): array { - $output = "/tmp/".str_slug(microtime()); + $output = $this->tmpPath(); $mimetype = mime_content_type($path); system('imagemin '.escapeshellarg($path).' --plugin=pngquant > '.escapeshellarg($output));