public ImageViewModel(ImageFile currentContent, string language) { // Note! Since we change the size of the images frequently by // adding /sizeName to the url, we get into trouble when EPiServer // renders the url in edit mode. Clicking an image in edit mode // renders the link to the actual ImageFile content, and we can't // just append the /sizeName to it. Because of this, we always // render the image for default view (not edit or preview) Url = ServiceLocator.Current.GetInstance<UrlResolver>().GetUrl( currentContent.ContentLink, language, new VirtualPathArguments(){ContextMode = ContextMode.Default}); Name = currentContent.Name; Description = currentContent.Description; Copyright = currentContent.Copyright; Language = language; if (currentContent.Link != null) { ExternalLink = currentContent.Link.ToString(); ExternalLinkTarget = currentContent.Link.IsAbsoluteUri ? "_blank" : ""; } try { HotSpots = JsonConvert.DeserializeObject<IEnumerable<HotSpotContainer>>(currentContent.HotSpotSettings); } catch (Exception) { // TODO: Remove empty catch - needs testing } }
private static void DeleteOldVersions(ImageFile file, StringBuilder sb) { IContentVersionRepository versionRepo = ServiceLocator.Current.GetInstance<IContentVersionRepository>(); IEnumerable<ContentVersion> versions = versionRepo.List(file.ContentLink); foreach (ContentVersion version in versions) { if (version.Status != VersionStatus.Published) { sb.AppendFormat("Deleting version: {0}", version.ContentLink); versionRepo.Delete(version.ContentLink); } } }
private static void DeleteBlobInstances(StringBuilder sb, BlobFactory blobFactory, ImageFile file) { //DeleteBlob(file.LargeThumbnail, sb, blobFactory); //DeleteBlob(file.ListImage, sb, blobFactory); //DeleteBlob(file.RelatedProduct, sb, blobFactory); //DeleteBlob(file.SimilarProduct, sb, blobFactory); //DeleteBlob(file.SliderImage, sb, blobFactory); //DeleteBlob(file.box1130, sb, blobFactory); //DeleteBlob(file.box370, sb, blobFactory); //DeleteBlob(file.box560, sb, blobFactory); ////DeleteBlob(file.box750, sb, blobFactory); //DeleteBlob(file.width110, sb, blobFactory); ////DeleteBlob(file.width1130, sb, blobFactory); //DeleteBlob(file.width179, sb, blobFactory); //DeleteBlob(file.width279, sb, blobFactory); //DeleteBlob(file.width320, sb, blobFactory); //DeleteBlob(file.width370, sb, blobFactory); //DeleteBlob(file.width379, sb, blobFactory); //DeleteBlob(file.width560, sb, blobFactory); //DeleteBlob(file.width580, sb, blobFactory); ////DeleteBlob(file.width750, sb, blobFactory); }