Skip to content

Instantly share code, notes, and snippets.

@ErikHen
Last active May 12, 2018 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErikHen/465fd2f586c5b9c006e8ec743204cc4d to your computer and use it in GitHub Desktop.
Save ErikHen/465fd2f586c5b9c006e8ec743204cc4d to your computer and use it in GitHub Desktop.
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