Last active
May 12, 2018 19:17
-
-
Save ErikHen/465fd2f586c5b9c006e8ec743204cc4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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