Wp2ghost/GhostImageManager/Models/GhostImage.cs
2026-09-24 19:23:54 +02:00

33 lines
1.1 KiB
C#

namespace GhostImageManager.Models;
public class GhostImage
{
public string Url { get; set; } = "";
public string FileName { get; set; } = "";
public string RelativePath { get; set; } = "";
public string FilePath { get; set; } = "";
public long FileSize { get; set; }
public DateTime LastModified { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public bool IsOrphaned { get; set; } = true;
public List<PostReference> UsedInPosts { get; set; } = new();
public string FormattedFileSize => FileSize switch
{
>= 1024 * 1024 => $"{FileSize / (1024.0 * 1024.0):F2} MB",
>= 1024 => $"{FileSize / 1024.0:F2} KB",
_ => $"{FileSize} B"
};
public string Dimensions => Width > 0 && Height > 0 ? $"{Width}x{Height}" : "n/a";
}
public class PostReference
{
public string PostId { get; set; } = "";
public string Title { get; set; } = "";
public string Slug { get; set; } = "";
public bool IsFeatureImage { get; set; }
public bool IsInContent { get; set; }
}