public override void ProcessRequest() { int assetId = GetIdFromFilename(); Asset asset = Asset.Get(assetId); string filename; if (asset.IsNull) { filename = "~/Images/Spacer.gif"; } else if (!EntitySecurityManager.CanUserViewAssetThumbnail(SessionInfo.Current.User, asset)) { filename = "~/Images/Spacer.gif"; } else { // First check if we need to display a fixed thumbnail filename = GetFixedThumbnailUrl(asset); // No fixed thumbnail, so get real thumbnail if (filename == string.Empty) { if (asset.IsProcessed) { // Asset is processed, so show either the thumbnail or unavailable image AssetThumbnailInfo info = new AssetThumbnailInfo(asset); filename = (info.FileExists) ? info.FilePath : "~/Images/Asset/Thumbnails/Unavailable.gif"; } else { // Otherwise, asset is not processed, so show the processing image filename = "~/Images/Asset/Thumbnails/Processing.gif"; } } } // Fix relative mappings if (filename.StartsWith("~/")) { filename = Context.Server.MapPath(filename); } // Send the image WriteFileToResponseStream(filename); }
protected void DeleteThumbnail_Click(object sender, EventArgs e) { AssetThumbnailInfo info = new AssetThumbnailInfo(Asset); if (info.FileExists) { try { File.Delete(info.FilePath); AssetThumbnail1.Initialise(Asset); FeedbackLabel1.SetSuccessMessage("Thumbnail deleted successfully"); } catch (Exception ex) { ExceptionHandler.HandleException(ex, "Error deleting thumbnail"); FeedbackLabel1.SetErrorMessage("Error deleting thumbnail: " + ex.Message); } } else { FeedbackLabel1.SetErrorMessage("Thumbnail file does not exist"); } }