diff --git a/core/extension.php b/core/extension.php index 205eef68..dbf4ec8a 100644 --- a/core/extension.php +++ b/core/extension.php @@ -398,6 +398,7 @@ abstract class DataHandlerExtension extends Extension $image = new Image(); assert(is_readable($filename)); + $image->tmp_file = $filename; $image->filesize = filesize($filename); $image->hash = md5_file($filename); $image->filename = (($pos = strpos($metadata['filename'], '?')) !== false) ? substr($metadata['filename'], 0, $pos) : $metadata['filename']; diff --git a/core/imageboard/image.php b/core/imageboard/image.php index 21aeae6a..921bade0 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -55,6 +55,7 @@ class Image public ?bool $image = null; public ?bool $audio = null; public ?int $length = null; + public ?string $tmp_file = null; public static array $bool_props = ["locked", "lossless", "video", "audio", "image"]; public static array $int_props = ["id", "owner_id", "height", "width", "filesize", "length"]; @@ -391,6 +392,9 @@ class Image */ public function get_image_filename(): string { + if(!is_null($this->tmp_file)) { + return $this->tmp_file; + } return warehouse_path(self::IMAGE_DIR, $this->hash); }