diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-29 13:02:41 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-08-29 13:02:41 +1000 |
| commit | e9f09559b80b83e12727fd24e90d8c7f31d64856 (patch) | |
| tree | ffb8f6d0f4ccc54618ff73164bcd323635dcea71 /Controllers | |
| parent | da640de1095395e28060211dfc9b6be82924bfd6 (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); } |
