The following example (and the ones after this) will use a flatter image to make it easier to see all the samples. To achieve this, we must create ResizeSettings
for this. It will be based on the default Content
settings.
-
-
-
To see the currentSrc change, make the window narrow, reload, and then drag it to become larger.
image src should appear here
@inherits Custom.Hybrid.Razor14
@{
var imgPath = App.Path + "/assets/img-resize";
var tomatoPicUrl = imgPath + "/tomatoes.jpg";
var flatSettings = Kit.Image.Settings("Content", aspectRatio: "8:1");
}
@Kit.Image.Img(tomatoPicUrl, settings: flatSettings)
<img src='/Portals/tutorials/2sxc/Tutorial-Razor/assets/img-resize/tomatoes.jpg?w=1400&h=175&quality=75&mode=crop&scale=both'
loading='lazy'
class='img-fluid'
width='1400'
height='175'>