public static async Task ProcessAsync(IOwinContext context, WebOnlineVideosMediaType mediatype, string id, int maxWidth, int maxHeight, string borders = null) { if (id == null) { throw new BadRequestException("GetOnlineVideosArtworkResized: id is null"); } ImageCache.CacheIdentifier identifier = ImageCache.GetIdentifier(StringToGuid(id), false, maxWidth, maxHeight, borders, 0, FanArtTypes.Thumbnail, FanArtMediaTypes.Undefined); Stream resourceStream; byte[] data; if (ImageCache.TryGetImageFromCache(context, identifier, out data)) { Logger.Info("GetOnlineVideosArtworkResized: got image from cache"); resourceStream = ImageFile(data); context.Response.ContentType = "image/*"; await SendWholeFileAsync(context, resourceStream, false); resourceStream.Dispose(); } byte[] resizedImage = Plugins.MP2Extended.WSS.Images.ResizeImage(OnlineVideosThumbs.GetThumb(mediatype, id), maxWidth, maxHeight, borders); resourceStream = ImageFile(resizedImage); context.Response.ContentType = "image/*"; await SendWholeFileAsync(context, resourceStream, false); resourceStream.Dispose(); }
public static async Task ProcessAsync(IOwinContext context, WebOnlineVideosMediaType mediatype, string id) { if (id == null) { throw new BadRequestException("GetOnlineVideosArtwork: id is null"); } Stream resourceStream = ImageFile(OnlineVideosThumbs.GetThumb(mediatype, id)); context.Response.ContentType = "image/*"; await SendWholeFileAsync(context, resourceStream, false); resourceStream.Dispose(); }