/// <summary> /// Initializes image data. /// </summary> /// <param name="image">Image information. Cannot be null.</param> /// <param name="thumbPersister">Thumb persister. Cannot be null.</param> /// <param name="ssl">Whether to generate SSL URLs.</param> /// <param name="sizes">Sizes to generate. If Nothing, no image URLs will be generated.</param> public EntryThumbForApiContract(IEntryImageInformation image, IEntryImagePersister thumbPersister, bool ssl, ImageSizes sizes = ImageSizes.All) { ParamIs.NotNull(() => image); ParamIs.NotNull(() => thumbPersister); if (string.IsNullOrEmpty(image.Mime) && sizes != ImageSizes.Nothing) { return; } if (sizes.HasFlag(ImageSizes.SmallThumb)) { UrlSmallThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.SmallThumb, ssl); } if (sizes.HasFlag(ImageSizes.Thumb)) { UrlThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.Thumb, ssl); } if (sizes.HasFlag(ImageSizes.TinyThumb)) { UrlTinyThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.TinyThumb, ssl); } }
public EntryThumbForApiContract(IEntryImageInformation image, IEntryImagePersister thumbPersister, bool ssl) { if (!string.IsNullOrEmpty(image.Mime)) { UrlSmallThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.SmallThumb, ssl); UrlThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.Thumb, ssl); UrlTinyThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.TinyThumb, ssl); } }
public EntryThumbForApiContract(IEntryImageInformation image, IEntryImagePersister thumbPersister, bool ssl) { if (!string.IsNullOrEmpty(image.Mime)) { UrlSmallThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.SmallThumb, ssl); UrlThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.Thumb, ssl); UrlTinyThumb = thumbPersister.GetUrlAbsolute(image, ImageSize.TinyThumb, ssl); } }
public static string GetUrlAbsolute(this IEntryImagePersister persister, IEntryImageInformation picture, ImageSize size, bool checkExists) { if (checkExists && !persister.HasImage(picture, size)) { return(null); } return(persister.GetUrlAbsolute(picture, size)); }
public EntryPictureFileContract(EntryPictureFile picture, IEntryImagePersister 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); }