diff options
| author | winter | 2025-02-07 19:45:36 +0000 |
|---|---|---|
| committer | winter | 2025-02-07 19:45:36 +0000 |
| commit | cc5ab7a365e2e045cc1af43727e56f56d088a0df (patch) | |
| tree | 1e80a0aedba4cb4dcdda098d7e4497a52cb105a9 /Digitigrade/Model | |
| parent | d18ec187847893f94418b29bc6a087d6b2dd9a2d (diff) | |
more stuff :3
- post form detects images better
- post form is preserved across navigations
- post form has most options hidden
- details/summaries use nicer icons
Diffstat (limited to 'Digitigrade/Model')
| -rw-r--r-- | Digitigrade/Model/StorageObject.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Digitigrade/Model/StorageObject.php b/Digitigrade/Model/StorageObject.php index 28c77aa..9d4bc1a 100644 --- a/Digitigrade/Model/StorageObject.php +++ b/Digitigrade/Model/StorageObject.php @@ -108,4 +108,35 @@ class StorageObject extends Model { } return path_to_uri("/storage/$this->oid"); } + + /** + * @return bool if this object is a supported image file + */ + public function isImage(): bool { + return in_array($this->mimetype, [ + 'image/apng', + 'image/avif', + 'image/gif', + 'image/jpeg', + 'image/png', + 'image/svg+xml', + 'image/webp', + ]); + } + + /** + * @return bool if this object 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->mimetype, 'audio/'); + } + + /** + * @return bool if this object 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->mimetype, 'video/'); + } }
\ No newline at end of file |
