From 07a4c7ead01514bd3f304f00abc38140a1d73634 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Mon, 14 Aug 2023 00:29:38 +1000 Subject: Added functionality for ingest tagging and implicit tags --- MediaController.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'MediaController.cs') 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 } } }; -- cgit v1.3