diff --git a/RMuseum/Controllers/ImageController.cs b/RMuseum/Controllers/ImageController.cs
index 0e100837..0a22d030 100644
--- a/RMuseum/Controllers/ImageController.cs
+++ b/RMuseum/Controllers/ImageController.cs
@@ -21,17 +21,18 @@ namespace RMuseum.Controllers
public class ImageController : Controller
{
///
- /// returns image stream
+ /// returns image stream with image/jpeg MIME type
///
///
///
+ ///
///
[HttpGet("{size}/{id}.jpg")]
[AllowAnonymous]
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
- public async Task Get(Guid id, string size)
+ public async Task Get(Guid id, string size, string mimeForResized = "image/jpeg")
{
RServiceResult img =
await _pictureFileService.GetImage(id);
@@ -56,8 +57,29 @@ namespace RMuseum.Controllers
return BadRequest(imgPath.ExceptionString);
- return new FileStreamResult(new FileStream(imgPath.Result, FileMode.Open, FileAccess.Read), img.Result.ContentType);
-
+ return new FileStreamResult(new FileStream(imgPath.Result, FileMode.Open, FileAccess.Read),
+ size == "orig" ?
+ img.Result.ContentType
+ :
+ mimeForResized
+ );
+ }
+
+ ///
+ /// returns image stream with image/webp MIME type
+ ///
+ ///
+ ///
+ ///
+
+ [HttpGet("{size}/{id}.webp")]
+ [AllowAnonymous]
+ [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
+
+ public async Task GetWebp(Guid id, string size)
+ {
+ return await Get(id, size, "image/webp");
}
///
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index d7297a00..21782c57 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -1449,9 +1449,18 @@
-
+
- returns image stream
+ returns image stream with image/jpeg MIME type
+
+
+
+
+
+
+
+
+ returns image stream with image/webp MIME type