summaryrefslogtreecommitdiff
path: root/MediaController.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-08-14 00:29:38 +1000
committerJake Mannens <jake@asger.xyz>2025-08-18 10:59:32 +1000
commit07a4c7ead01514bd3f304f00abc38140a1d73634 (patch)
tree6606addd04356c1b39e316ae3c7deb39bea28442 /MediaController.cs
parentb8833351cbbd6505d86e3fb8a791344fa1fbc94c (diff)
Added functionality for ingest tagging and implicit tags
Diffstat (limited to 'MediaController.cs')
-rw-r--r--MediaController.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/MediaController.cs b/MediaController.cs
index 29a8f88..620b3ee 100644
--- a/MediaController.cs
+++ b/MediaController.cs
@@ -64,7 +64,7 @@ public class MediaController : Controller {
if(w > image.Width || h > image.Height)
return BadRequest("Requested thumbnail size is larger than original media");
- int width = (int) (w is not null ? w : image.Width * h / image.Height);
+ int width = (int) (w is not null ? w : image.Width * h / image.Height);
int height = (int) (h is not null ? h : image.Height * w / image.Width);
var thumbPath = config.GetPath(media, width, height);
@@ -166,11 +166,17 @@ public class MediaController : Controller {
.FirstOrDefault(m => m.Checksum == hash);
if(media is null) {
+ var ingestTagDef = db.TagDefinitions
+ .First(td => td.Source == TagSource.Internal && td.Name == "ingest");
+
media = new() {
Checksum = hash,
MimeType = mime,
UploadedFiles = new() {
fileRecord
+ },
+ Tags = new() {
+ new() { TagDefinition = ingestTagDef }
}
};