public EntryThumbForApiContract(IEntryImageInformation image, IAggregatedEntryImageUrlFactory thumbPersister, ImageSizes sizes = ImageSizes.All) { ParamIs.NotNull(() => image); ParamIs.NotNull(() => thumbPersister); Mime = image.Mime; if (string.IsNullOrEmpty(image.Mime) && sizes != ImageSizes.Nothing) { return; } if (sizes.HasFlag(ImageSizes.Original)) { UrlOriginal = thumbPersister.GetUrlAbsolute(image, ImageSize.Original); } if (sizes.HasFlag(ImageSizes.SmallThumb)) { UrlSmallThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.SmallThumb); } if (sizes.HasFlag(ImageSizes.Thumb)) { UrlThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.Thumb); } if (sizes.HasFlag(ImageSizes.TinyThumb)) { UrlTinyThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.TinyThumb); } }
public EntryPictureFileContract(EntryPictureFile picture, IAggregatedEntryImageUrlFactory imageStore) { ParamIs.NotNull(() => picture); EntryType = picture.EntryType; Id = picture.Id; Mime = picture.Mime; Name = picture.Name; OwnerEntryId = picture.OwnerEntryId; ThumbUrl = imageStore.GetUrlAbsolute(picture, ImageSize.Thumb, true); Purpose = picture.Purpose; }