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>2023-08-14 00:29:38 +1000
commit5b00f23b28e3a09a4120101a8be8802d009e5d84 (patch)
tree53a9190c2c8ad57b25c6e429e97fcc8ff6bdeb23 /MediaController.cs
parent3ce156d00197a894ac9b0507544afd51aec2a0fd (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 }
}
};