Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace MyEpiSite.Business.Rendering
{
public class ImageType
{
public int? DefaultImgWidth { get; set; } //this size will be used in browsers that don't support the picture element
public int[] SrcSetWidths { get; set; } // the different image widths you want the browser to select from
public string[] SrcSetSizes { get; set; }
public double HeightRatio { get; set; }
public int Quality { get; set; }
public ImageType()
{
Quality = 80; //default quality
}
}
public static class ImageTypes
{
public static ImageType HeroImage = new ImageType
{
DefaultImgWidth = 1280,
SrcSetWidths = new[] { 375, 750, 1440, 1920 },
SrcSetSizes = new[] { "100vw" },
HeightRatio = 0.5625 //16:9
};
public static ImageType Thumbnail = new ImageType
{
DefaultImgWidth = 200,
SrcSetWidths = new[] {200, 400},
SrcSetSizes = new[] { "200px" },
HeightRatio = 1 //square
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment