Skip to content

Commit

Permalink
Added ImagePickerImage constructor overload
Browse files Browse the repository at this point in the history
  • Loading branch information
abjerner committed Aug 15, 2022
1 parent a189ca4 commit c774b5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Skybrud.ImagePicker/Models/ImagePickerImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,18 @@ public class ImagePickerImage {

#region Constructors

public ImagePickerImage(IPublishedContent content) : this(content, null) { }

public ImagePickerImage(IPublishedContent content, ImagePickerConfiguration config) {


// Make sure we have a configuration
config ??= new ImagePickerConfiguration();

// Get the width and height
int width = content.Value<int>(Constants.Conventions.Media.Width);
int height = content.Value<int>(Constants.Conventions.Media.Height);

// Populate the properties
Media = content;
Width = width;
Height = height;
Expand Down

0 comments on commit c774b5a

Please sign in to comment.