[core] if image is created from a temp file, have get_image_filename() return that file
This commit is contained in:
parent
8b18b73f94
commit
c494bf293d
2 changed files with 5 additions and 0 deletions
|
@ -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'];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue