public void Sweep() { if (_wasStarted) return; lock (_syncRoot) { if (_lastRun > DateTime.Now.AddMinutes(CleanPeriodInMinutes * -1)) { return; } _wasStarted = true; try { var resizeService = new ImageResizerService(_settingsService); resizeService.DeleteOldCache(); _lastRun = DateTime.Now; _settingsService.Settings.DeleteOldLastJobRun = _lastRun; _settingsService.SaveSettings(); } catch(Exception e) { Logger.Error(e, "Summit.Core Cache cleanup task failed"); } finally { _wasStarted = false; } } }
public static IHtmlString ResizedImageUrl( this HtmlHelper helper, string url, int width = 0, int height = 0, string settings = "", string defaultImage = "/modules/Summit.Core/content/image_not_found.jpg") { var urlHelper = new UrlHelper(helper.ViewContext.RequestContext); if (string.IsNullOrWhiteSpace(url)) { return new HtmlString(string.Empty); } url = urlHelper.Content(url); var resizeService = new ImageResizerService(null); url = resizeService.ResizeImage(url, width, height, quality: 100, settings: settings); if (string.IsNullOrWhiteSpace(url) && !string.IsNullOrWhiteSpace(defaultImage)) { url = resizeService.ResizeImage(defaultImage, width, height, quality: 100, settings: settings); } return new HtmlString(url); }
public void ClearCache() { var resizeService = new ImageResizerService(this.settingsService); resizeService.ClearCache(); }
public void CacheDeleteOld() { var resizeService = new ImageResizerService(this.settingsService); resizeService.DeleteOldCache(); }