diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2025-01-10 14:55:22 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2025-01-10 14:55:22 +0000 |
| commit | 339493dbd88f45eee9d044123d13717558047fca (patch) | |
| tree | b5fc6959aaae455e25873804109742d053f3ac5b /lib/models/FileRef.php | |
| parent | 10636268c2303409879014e01eadb3cbe05bd885 (diff) | |
add Vips as CorePlugin, re #4258
Merge request studip/studip!3432
Diffstat (limited to 'lib/models/FileRef.php')
| -rw-r--r-- | lib/models/FileRef.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php index 2a7f485..4196367 100644 --- a/lib/models/FileRef.php +++ b/lib/models/FileRef.php @@ -299,7 +299,6 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange return mb_strpos($this->mime_type, 'audio/') === 0; } - /** * Determines if the FileRef references a video file. * @@ -311,6 +310,22 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange } /** + * Get the preferred content disposition of this file. + */ + public function getContentDisposition(): string + { + if ($this->isImage() || $this->isAudio() || $this->isVideo()) { + return 'inline'; + } + + if (in_array($this->mime_type, ['application/pdf', 'text/plain'])) { + return 'inline'; + } + + return 'attachment'; + } + + /** * Export available data of a given user into a storage object * (an instance of the StoredUserData class) for that user. * |
