public void TestImageObject() { var blogPosting = new BlogPosting(); blogPosting.Image = new ImageObject() { Url = "http://whatever.com/image.png", Width = new QuantitativeValue() { Value = 500 }, Height = new QuantitativeValue() { Value = 500 } }; System.Diagnostics.Debug.Write(blogPosting.ToIndentedJson()); }
public Thing Map(BlogItemPage content) { var posting = new BlogPosting { Headline = content.Name, Description = content.TeaserText ?? content.PageDescription ?? string.Empty, Author = new Person { Name = content.Author ?? string.Empty }, DatePublished = new DateTimeOffset(content.StartPublish ?? content.Changed), DateModified = new DateTimeOffset(content.Changed) }; if (content != null && !ContentReference.IsNullOrEmpty(content.PageImage)) { posting.Image = (content.PageImage.Get <MediaData>() as MediaData)?.GetUri(true); } return(posting); }