[ENTITY] Add utils to Attachment and AttachmentThumbnail to get the corresponding URL and html representation parameters

This commit is contained in:
2021-04-25 21:26:53 +00:00
parent 2a74dced22
commit 9a7f1358c2
2 changed files with 24 additions and 0 deletions

View File

@@ -233,6 +233,11 @@ class Attachment extends Entity
return Common::config('attachments', 'dir') . $this->getFilename();
}
public function getAttachmentUrl()
{
return Router::url('attachment_thumbnail', ['id' => $this->getAttachmentId(), 'w' => Common::config('attachment', 'width'), 'h' => Common::config('attachment', 'height')]);
}
public static function schemaDef(): array
{
return [