tareqimbasher / NetPad

A cross-platform C# editor and playground.
MIT License
1.31k stars 66 forks source link

Ability to control display size of media files #203

Closed tareqimbasher closed 5 months ago

tareqimbasher commented 5 months ago

Change default media file styling to more sane values and adds ability for user to choose display size for media files. Example:

// Method 1: Use the new DisplayWidth  and DisplayHeight  properties
new Image("/path/image.png")
{
    DisplayWidth = "400px",
    DisplayHeight = "400px"
}.Dump()

// Method 2: Use chainable methods WithDisplayWidth(), WithDisplayHeight(), WithDisplaySize()
Image.FromPath("/path/image.png")
    .WithDisplaySize("400px", "200px") // width, height
    .Dump();

Values can be any valid value for CSS properties width and height:

 Image.FromPath("/path/image.png")
    .WithDisplayWidth("75%")
    .Dump();