From a58f7a0ee23bb541c9e0f2c90c42195d613cf2cb Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Sun, 14 Jul 2024 02:43:48 +0200 Subject: [PATCH] Fix docs about ImageStyle (#1988) * Fix docs about ImageStyle With current fix, the image style is created with the correct name, as the original file. * Update Guide/file-storage.markdown Co-authored-by: Marc Scholten * Update Guide/file-storage.markdown --------- Co-authored-by: Marc Scholten --- Guide/file-storage.markdown | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Guide/file-storage.markdown b/Guide/file-storage.markdown index 844658404..e3b66a48a 100644 --- a/Guide/file-storage.markdown +++ b/Guide/file-storage.markdown @@ -869,6 +869,7 @@ import Web.Controller.Prelude import IHP.ControllerSupport import System.Directory (doesFileExist) import qualified Data.Text as Text +import qualified Data.UUID as UUID (fromText) instance Controller ImageStyleController where action RenderImageStyleAction { width, height, originalImagePath } = do @@ -891,6 +892,8 @@ instance Controller ImageStyleController where let options :: StoreFileOptions = def { directory = imageStylePathDirectory , preprocess = applyImageMagick "jpg" ["-resize", cs size <> "^", "-gravity", "center", "-extent", cs size, "-quality", "85%", "-strip"] + -- Keep the original filename. + , fileName = UUID.fromText uuid } storedFile <- storeFileFromPath (cs $ storagePrefix <> originalImageDirectory <> "/" <> uuid) options