changing poet image extensions from png to gif
This commit is contained in:
parent
820dd32b71
commit
14ea921120
@ -212,7 +212,7 @@ namespace RMuseum.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get poet image
|
||||
/// get poet image with png ext
|
||||
/// </summary>
|
||||
/// <param name="url">sample: hafez</param>
|
||||
/// <returns></returns>
|
||||
@ -220,10 +220,24 @@ namespace RMuseum.Controllers
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetPoetImageInPng(string url)
|
||||
{
|
||||
return await GetPoetImage(url.Replace(".png", ".gif"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get poet image
|
||||
/// </summary>
|
||||
/// <param name="url">sample: hafez</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("poet/image/{url}.gif")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(FileStreamResult))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetPoetImage(string url)
|
||||
{
|
||||
|
||||
var cacheKey = $"poet/image/{url}.png";
|
||||
var cacheKey = $"poet/image/{url}.gif";
|
||||
var cacheKeyForLastModified = $"{cacheKey}/lastModified";
|
||||
if (!_memoryCache.TryGetValue(cacheKey, out string imagePath) || !_memoryCache.TryGetValue(cacheKeyForLastModified, out DateTime lastModified))
|
||||
{
|
||||
@ -269,7 +283,7 @@ namespace RMuseum.Controllers
|
||||
return StatusCode(StatusCodes.Status304NotModified);
|
||||
}
|
||||
|
||||
return new FileStreamResult(new FileStream(imagePath, FileMode.Open, FileAccess.Read), "image/png");
|
||||
return new FileStreamResult(new FileStream(imagePath, FileMode.Open, FileAccess.Read), "image/gif");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -725,6 +725,13 @@
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetPoetImageInPng(System.String)">
|
||||
<summary>
|
||||
get poet image with png ext
|
||||
</summary>
|
||||
<param name="url">sample: hafez</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetPoetImage(System.String)">
|
||||
<summary>
|
||||
get poet image
|
||||
|
||||
@ -56,7 +56,7 @@ namespace RMuseum.Services.Implementation
|
||||
RootCatId = cat.Id,
|
||||
Nickname = poet.Nickname,
|
||||
Published = poet.Published,
|
||||
ImageUrl = poet.RImageId == null ? "" : $"/api/ganjoor/poet/image{cat.FullUrl}.png"
|
||||
ImageUrl = poet.RImageId == null ? "" : $"/api/ganjoor/poet/image{cat.FullUrl}.gif"
|
||||
}
|
||||
)
|
||||
.AsNoTracking()
|
||||
@ -314,7 +314,7 @@ namespace RMuseum.Services.Implementation
|
||||
RootCatId = _context.GanjoorCategories.Where(c => c.PoetId == p.Id && c.ParentId == null).Single().Id,
|
||||
Nickname = p.Nickname,
|
||||
Published = p.Published,
|
||||
ImageUrl = p.RImageId == null ? "" : $"/api/ganjoor/poet/image{_context.GanjoorCategories.Where(c => c.PoetId == p.Id && c.ParentId == null).Single().FullUrl}.png"
|
||||
ImageUrl = p.RImageId == null ? "" : $"/api/ganjoor/poet/image{_context.GanjoorCategories.Where(c => c.PoetId == p.Id && c.ParentId == null).Single().FullUrl}.gif"
|
||||
}).AsNoTracking().FirstOrDefaultAsync(),
|
||||
Cat = catViewModel
|
||||
}
|
||||
@ -438,7 +438,7 @@ namespace RMuseum.Services.Implementation
|
||||
RootCatId = cat.Id,
|
||||
Nickname = poet.Nickname,
|
||||
Published = poet.Published,
|
||||
ImageUrl = poet.RImageId == null ? "" : $"/api/ganjoor/poet/image{cat.FullUrl}.png"
|
||||
ImageUrl = poet.RImageId == null ? "" : $"/api/ganjoor/poet/image{cat.FullUrl}.gif"
|
||||
}
|
||||
)
|
||||
.AsNoTracking().SingleAsync();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user