Skip to content

Commit

Permalink
Fix docs about ImageStyle (#1988)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update Guide/file-storage.markdown

---------

Co-authored-by: Marc Scholten <[email protected]>
  • Loading branch information
amitaibu and mpscholten authored Jul 14, 2024
1 parent 4526f58 commit a58f7a0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Guide/file-storage.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a58f7a0

Please sign in to comment.