throw new PermissionDeniedException();
}
- $filename = $file->getPath() . $file->getSourceFilename();
+ $filename = $file->getPathname();
$response = new Response(
new Stream($filename),
);
/** @var array<string, FileThumbnail> */
private array $thumbnails = [];
+ public function getFilename(): string
+ {
+ return \sprintf(
+ '%d-%s.bin',
+ $this->fileID,
+ $this->fileHash,
+ );
+ }
+
public function getPath(): string
{
$folderA = \substr($this->fileHash, 0, 2);
);
}
- public function getSourceFilename(): string
+ public function getPathname(): string
{
- return \sprintf(
- '%d-%s.bin',
- $this->fileID,
- $this->fileHash,
- );
+ return $this->getPath() . $this->getFilename();
}
public function getLink(): string
public static function createFromTemporary(FileTemporary $fileTemporary): File
{
- $mimeType = FileUtil::getMimeType($fileTemporary->getPath() . $fileTemporary->getFilename());
+ $pathname = $fileTemporary->getPathname();
+ $mimeType = FileUtil::getMimeType($pathname);
$isImage = match ($mimeType) {
'image/gif' => true,
'image/jpeg' => true,
$width = $height = null;
if ($isImage) {
- [$width, $height] = \getimagesize($fileTemporary->getPath() . $fileTemporary->getFilename());
+ [$width, $height] = \getimagesize($pathname);
}
$fileAction = new FileAction([], 'create', ['data' => [
}
\rename(
- $fileTemporary->getPath() . $fileTemporary->getFilename(),
- $filePath . $file->getSourceFilename()
+ $pathname,
+ $filePath . $file->getFilename()
);
return $file;
);
}
+ public function getPathname(): string
+ {
+ return $this->getPath() . $this->getFilename();
+ }
+
public function getContext(): array
{
return JSON::decode($this->context);
if ($imageAdapter === null) {
$imageAdapter = ImageHandler::getInstance()->getAdapter();
- $imageAdapter->loadFile($file->getPath() . $file->getSourceFilename());
+ $imageAdapter->loadFile($file->getPathname());
}
\assert($imageAdapter instanceof ImageAdapter);