mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-08 04:18:06 +02:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
#nullable disable
|
|
|
|
#pragma warning disable CS1591
|
|
|
|
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; }
|
|
|
|
public MediaProtocol Protocol { get; set; }
|
|
|
|
public Stream Stream { get; set; }
|
|
|
|
public ImageFormat Format { get; set; }
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|