diff options
| author | winter | 2025-02-07 18:26:05 +0000 |
|---|---|---|
| committer | winter | 2025-02-07 18:26:05 +0000 |
| commit | d18ec187847893f94418b29bc6a087d6b2dd9a2d (patch) | |
| tree | 8ea4451cb1f62f8041eae71ca60ec2b64fafe8b2 /Digitigrade | |
| parent | 43f0b9f41a582925838b2ba686110b2f07576be3 (diff) | |
localise note timestamps and stuff
Diffstat (limited to 'Digitigrade')
| -rw-r--r-- | Digitigrade/Model/NoteAttachment.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Digitigrade/Model/NoteAttachment.php b/Digitigrade/Model/NoteAttachment.php index 1ca0064..8c6fb1f 100644 --- a/Digitigrade/Model/NoteAttachment.php +++ b/Digitigrade/Model/NoteAttachment.php @@ -29,4 +29,35 @@ class NoteAttachment extends Model { } return null; } + + /** + * @return bool if this attachment is a supported image file + */ + public function isImage(): bool { + return in_array($this->type, [ + 'image/apng', + 'image/avif', + 'image/gif', + 'image/jpeg', + 'image/png', + 'image/svg+xml', + 'image/webp', + ]); + } + + /** + * @return bool if this attachment is a supported audio file + */ + public function isAudio(): bool { + // TODO: be a bit more careful about what counts as supported + return str_starts_with($this->type, 'audio/'); + } + + /** + * @return bool if this attachment is a supported video file + */ + public function isVideo(): bool { + // TODO: be a bit more careful about what counts as supported + return str_starts_with($this->type, 'video/'); + } }
\ No newline at end of file |
