summaryrefslogtreecommitdiff
path: root/Controllers
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-08-29 13:02:41 +1000
committerJake Mannens <jake@asger.xyz>2025-08-20 00:48:44 +1000
commit49dc2dda8b6188de0a99ff5070d6280122143e70 (patch)
tree2bda1f99c18e04f4019ca8fa57bcfd3c2064c100 /Controllers
parent277642e460e2c1cb68952de86249f1525a9c1ab0 (diff)
Added width and height properties to media objects
Diffstat (limited to 'Controllers')
-rw-r--r--Controllers/MediaController.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Controllers/MediaController.cs b/Controllers/MediaController.cs
index 6e04670..674b406 100644
--- a/Controllers/MediaController.cs
+++ b/Controllers/MediaController.cs
@@ -56,13 +56,15 @@ 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);
+ #pragma warning disable CS8629
+ 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);
+ #pragma warning restore CS8629
var thumbPath = mediaService.GetPath(media, width, height);
if(!System.IO.File.Exists(thumbPath)) {
- image.Resize(new MagickGeometry(width, height));
+ image.Resize(width, height);
image.Write(thumbPath);
}