File tree Expand file tree Collapse file tree 5 files changed +53
-7
lines changed
IHP/FileStorage/Preprocessor Expand file tree Collapse file tree 5 files changed +53
-7
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ final: prev: {
2424 ihp-job-dashboard = localPackage "ihp-job-dashboard" ;
2525 wai-asset-path = localPackage "wai-asset-path" ;
2626 wai-flash-messages = localPackage "wai-flash-messages" ;
27+ ihp-imagemagick = localPackage "ihp-imagemagick" ;
2728
2829 fsnotify = final . haskell . lib . dontCheck ( super . callHackageDirect { pkg = "fsnotify" ; ver = "0.4.3.0" ; sha256 = "sha256-6SJ8w2p0HNhMPjdQzxx4oqsyI48/C/K7wh+kLNy9/fM=" ; } { } ) ;
2930
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ that is defined in flake-module.nix
144144 ihp-job-dashboard = pkgs . ghc . ihp-job-dashboard ;
145145 wai-asset-path = pkgs . ghc . wai-asset-path ;
146146 wai-flash-messages = pkgs . ghc . wai-flash-messages ;
147+ ihp-imagemagick = pkgs . ghc . ihp-imagemagick ;
147148
148149 run-script = pkgs . stdenv . mkDerivation {
149150 pname = "run-script" ;
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ module IHP.FileStorage.Preprocessor.ImageMagick
77( applyImageMagick
88) where
99
10- import IHP. Prelude
10+ import Prelude
1111
12+ import Data.Text (Text )
13+ import qualified Data.Text as Text
1214import qualified Network.Wai.Parse as Wai
1315import qualified Data.ByteString.Lazy as LBS
1416import qualified System.IO.Temp as Temp
@@ -48,15 +50,13 @@ import qualified System.Process as Process
4850-- > company <- company |> updateRecord
4951-- > redirectTo EditCompanyAction { .. }
5052--
51- applyImageMagick :: Text -> [String ] -> Wai. FileInfo LByteString -> IO (Wai. FileInfo LByteString )
53+ applyImageMagick :: Text -> [String ] -> Wai. FileInfo LBS. LazyByteString -> IO (Wai. FileInfo LBS. LazyByteString )
5254applyImageMagick convertTo otherParams fileInfo = do
5355 Temp. withTempDirectory " /tmp" " ihp-upload" $ \ tempPath -> do
5456 let tempFilePath = tempPath <> " /image"
55- let convertedFilePath = tempPath <> " /converted." <> cs convertTo
57+ let convertedFilePath = tempPath <> " /converted." <> Text. unpack convertTo
5658
57- fileInfo
58- |> (. fileContent)
59- |> LBS. writeFile tempFilePath
59+ LBS. writeFile tempFilePath fileInfo. fileContent
6060
6161 let params :: [String ] = [tempFilePath] <> otherParams <> [convertedFilePath]
6262 Process. callProcess " magick" params
Original file line number Diff line number Diff line change 1+ cabal-version : 2.2
2+ name : ihp-imagemagick
3+ version : 1.4.0
4+ synopsis : ImageMagick preprocessing for IHP file uploads
5+ description : Preprocess uploaded images with ImageMagick in IHP apps
6+ license : MIT
7+ author : digitally induced GmbH
8+ 9+ bug-reports : https://github.com/digitallyinduced/ihp/issues
10+ category : Web
11+ build-type : Simple
12+
13+ source-repository head
14+ type : git
15+ location : https://github.com/digitallyinduced/ihp.git
16+
17+ common ihp-std
18+ default-language : GHC2021
19+ default-extensions :
20+ NoImplicitPrelude
21+ OverloadedLabels
22+ OverloadedRecordDot
23+ DuplicateRecordFields
24+ DisambiguateRecordFields
25+ TypeApplications
26+ TemplateHaskell
27+ QuasiQuotes
28+ PackageImports
29+ ScopedTypeVariables
30+ BlockArguments
31+ OverloadedStrings
32+ ImplicitParams
33+
34+ library
35+ import : ihp-std
36+ build-depends :
37+ base >= 4.17.0 && < 4.22
38+ , text
39+ , bytestring
40+ , wai-extra
41+ , process
42+ , temporary
43+ hs-source-dirs : .
44+ exposed-modules : IHP.FileStorage.Preprocessor.ImageMagick
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ common shared-properties
137137 , wai-asset-path
138138 , wai-flash-messages
139139 , slugger
140+ , ihp-imagemagick
140141 default-extensions :
141142 OverloadedStrings
142143 , NoImplicitPrelude
@@ -262,7 +263,6 @@ library
262263 , IHP.FileStorage.Types
263264 , IHP.FileStorage.ControllerFunctions
264265 , IHP.FileStorage.Config
265- , IHP.FileStorage.Preprocessor.ImageMagick
266266 , IHP.Pagination.ControllerFunctions
267267 , IHP.Pagination.ViewFunctions
268268 , IHP.Pagination.Types
You can’t perform that action at this time.
0 commit comments