You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Controller/Providers/DynamicImageResponse.cs

35 lines
1012 B

using System;
using System.IO;
using MediaBrowser.Model.Drawing;
namespace MediaBrowser.Controller.Providers
{
public class DynamicImageResponse
{
public string Path { get; set; }
public Stream Stream { get; set; }
public ImageFormat Format { get; set; }
public bool HasImage { get; set; }
public string InternalCacheKey { get; set; }
public void SetFormatFromMimeType(string mimeType)
{
if (mimeType.EndsWith("gif", StringComparison.OrdinalIgnoreCase))
{
Format = ImageFormat.Gif;
}
else if (mimeType.EndsWith("bmp", StringComparison.OrdinalIgnoreCase))
{
Format = ImageFormat.Bmp;
}
else if (mimeType.EndsWith("png", StringComparison.OrdinalIgnoreCase))
{
Format = ImageFormat.Png;
}
else
{
Format = ImageFormat.Jpg;
}
}
}
}