[UTILS][TemporaryFile] Change way TemporaryFile takes arguments and it's internal implementation

This commit is contained in:
2021-05-02 15:02:26 +00:00
parent 3b39046a38
commit 2b83a4b627
5 changed files with 34 additions and 38 deletions

View File

@@ -77,7 +77,7 @@ class ImageEncoder extends Plugin
$type = self::preferredType();
$extension = image_type_to_extension($type, include_dot: true);
$temp = new TemporaryFile(prefix: null, suffix: $extension); // This handles deleting the file if some error occurs
$temp = new TemporaryFile(['prefix' => 'image', 'suffix' => $extension]); // This handles deleting the file if some error occurs
$mimetype = image_type_to_mime_type($type);
if ($mimetype != $original_mimetype) {
// If title seems to be a filename with an extension

View File

@@ -72,7 +72,7 @@ class VideoEncoder extends Plugin
// FFmpeg can't edit existing files in place,
// generate temporary output file to avoid that
$tempfile = new TemporaryFile('gs-outpath');
$tempfile = new TemporaryFile(['prefix' => 'video']);
// Generate palette file. FFmpeg explictly needs to be told the
// extension for PNG files outputs