diff --git a/cards/Alpha Deathclaw.png b/cards/Alpha Deathclaw.png index 5f36046..7e10de2 100644 Binary files a/cards/Alpha Deathclaw.png and b/cards/Alpha Deathclaw.png differ diff --git a/gallery/BuildGallery.linq b/gallery/BuildGallery.linq index 107067a..f762e3f 100644 --- a/gallery/BuildGallery.linq +++ b/gallery/BuildGallery.linq @@ -257,7 +257,15 @@ async Task CompressCardImagesAsync() .Where(c => new FileInfo(c).Length > 2_000_000); await Parallel.ForEachAsync(rawCardImages, async (rawCardImage, _) => { - File.Copy(rawCardImage, Path.Combine(RawImageRepository, Path.GetFileName(rawCardImage))); + $"Compressing {Path.GetFileName(rawCardImage)}".Dump(); + var rawImageStorePath = Path.Combine(RawImageRepository, Path.GetFileName(rawCardImage)); + if (File.Exists(rawImageStorePath)) + { + var rawImageHistoryPath = Path.Combine(RawImageRepository, "Old Versions", Path.GetFileNameWithoutExtension(rawCardImage) + DateTime.Now.ToString("yyyyMMddHHmmss") + Path.GetExtension(rawCardImage)); + Directory.CreateDirectory(Path.GetDirectoryName(rawImageHistoryPath)!); + File.Move(rawImageStorePath, rawImageHistoryPath); + } + File.Copy(rawCardImage, rawImageStorePath); await (await Tinify.FromFile(rawCardImage)).ToFile(rawCardImage); if (new FileInfo(rawCardImage).Length > 1_500_000) {