2018-12-27 16:27:57 -07:00
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using MediaBrowser.Model.Drawing;
|
|
|
|
using MediaBrowser.Model.MediaInfo;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers
|
|
|
|
{
|
|
|
|
public class DynamicImageResponse
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public MediaProtocol Protocol { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public Stream Stream { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public ImageFormat Format { get; set; }
|
2020-03-09 07:05:03 -07:00
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
public bool HasImage { 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-13 12:30:58 -07:00
|
|
|
}
|