diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-29 13:02:41 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2025-08-20 00:48:44 +1000 |
| commit | 49dc2dda8b6188de0a99ff5070d6280122143e70 (patch) | |
| tree | 2bda1f99c18e04f4019ca8fa57bcfd3c2064c100 /Controllers | |
| parent | 277642e460e2c1cb68952de86249f1525a9c1ab0 (diff) | |
Added width and height properties to media objects
Diffstat (limited to 'Controllers')
| -rw-r--r-- | Controllers/MediaController.cs | 6 |
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); } |
