private string SaveImage() { if (!DoesImageNeedHandling) { return _originalPath; } var image = new KalikoImage(Server.MapPath(_originalPath)); // TODO: Temporary fix for selecting full image, try to do this without loading the image first.. if (IsCropValueFullImage(image)) { return _originalPath; } if (_hasCropValues) { image.Crop(_cropX, _cropY, _cropW, _cropH); } if (_width > 0 || _height > 0) { image.Resize(_width, _height); } var imagePath = GetNewImagePath(); var serverPath = Server.MapPath(imagePath); if (File.Exists(serverPath)) { var originalServerPath = Server.MapPath(_originalPath); if (File.GetLastWriteTime(originalServerPath) < File.GetLastWriteTime(serverPath)) { return imagePath; } File.Delete(serverPath); } // TODO: Config quality image.SaveJpg(Server.MapPath(imagePath), 90); return imagePath; }