throwing out imagemagick
This commit is contained in:
parent
53795a448a
commit
8927bf8e32
5 changed files with 76 additions and 69 deletions
|
@ -94,7 +94,7 @@ postAdminAlbumSettingsR albumId = do
|
||||||
adminAlbumSettingsForm album albumId users
|
adminAlbumSettingsForm album albumId users
|
||||||
case res of
|
case res of
|
||||||
FormSuccess temp -> do
|
FormSuccess temp -> do
|
||||||
width <- getThumbWidth $ Just $ L.tail $ fromMaybe "a" $ albumSamplePic temp
|
width <- getThumbWidth $ albumSamplePic temp
|
||||||
_ <- runDB $ update albumId
|
_ <- runDB $ update albumId
|
||||||
[ AlbumTitle =. albumTitle temp
|
[ AlbumTitle =. albumTitle temp
|
||||||
, AlbumShares =. albumShares temp
|
, AlbumShares =. albumShares temp
|
||||||
|
|
|
@ -108,7 +108,7 @@ postAlbumSettingsR albumId = do
|
||||||
else do
|
else do
|
||||||
return [()]
|
return [()]
|
||||||
-- nothing to do here
|
-- nothing to do here
|
||||||
width <- getThumbWidth $ Just $ L.tail $ fromMaybe ['a'] $ albumSamplePic temp
|
width <- getThumbWidth $ albumSamplePic temp
|
||||||
_ <- runDB $ update albumId
|
_ <- runDB $ update albumId
|
||||||
[ AlbumTitle =. albumTitle temp
|
[ AlbumTitle =. albumTitle temp
|
||||||
, AlbumShares =. newShares
|
, AlbumShares =. newShares
|
||||||
|
|
20
Helper.hs
20
Helper.hs
|
@ -34,13 +34,14 @@ import Yesod
|
||||||
import Numeric (readHex, showHex)
|
import Numeric (readHex, showHex)
|
||||||
import Network.Mail.Mime
|
import Network.Mail.Mime
|
||||||
import Text.Blaze.Html.Renderer.Utf8
|
import Text.Blaze.Html.Renderer.Utf8
|
||||||
import Graphics.ImageMagick.MagickWand
|
|
||||||
import Filesystem.Path.CurrentOS
|
import Filesystem.Path.CurrentOS
|
||||||
import Database.Bloodhound
|
import Database.Bloodhound
|
||||||
import Network.HTTP.Client
|
import Network.HTTP.Client
|
||||||
import Network.HTTP.Types.Status as S
|
import Network.HTTP.Types.Status as S
|
||||||
import Control.Monad (when)
|
import Control.Monad (when)
|
||||||
|
|
||||||
|
import Codec.Picture
|
||||||
|
|
||||||
getUserIdFromText :: T.Text -> UserId
|
getUserIdFromText :: T.Text -> UserId
|
||||||
getUserIdFromText tempUserId =
|
getUserIdFromText tempUserId =
|
||||||
case key of
|
case key of
|
||||||
|
@ -192,10 +193,19 @@ mediumStaticThumbRoute medium =
|
||||||
getThumbWidth :: MonadIO m => Maybe String -> m Int
|
getThumbWidth :: MonadIO m => Maybe String -> m Int
|
||||||
getThumbWidth path
|
getThumbWidth path
|
||||||
| path == Nothing = pure 230
|
| path == Nothing = pure 230
|
||||||
| otherwise = liftIO $ withMagickWandGenesis $ do
|
| otherwise = liftIO $ do
|
||||||
(_, w) <- magickWand
|
eorig <- readImage $ fromJust path
|
||||||
readImage w (T.pack $ fromJust path)
|
case eorig of
|
||||||
getImageWidth w
|
Right orig -> do
|
||||||
|
let img = convertRGBA8 orig
|
||||||
|
return $ imageWidth img
|
||||||
|
Left e ->
|
||||||
|
error e
|
||||||
|
-- | path == Nothing = pure 230
|
||||||
|
-- | otherwise = liftIO $ withMagickWandGenesis $ do
|
||||||
|
-- (_, w) <- magickWand
|
||||||
|
-- readImage w (T.pack $ fromJust path)
|
||||||
|
-- getImageWidth w
|
||||||
|
|
||||||
multiFileField :: (Monad m, RenderMessage (HandlerSite m) FormMessage) => Field m [FileInfo]
|
multiFileField :: (Monad m, RenderMessage (HandlerSite m) FormMessage) => Field m [FileInfo]
|
||||||
multiFileField = Field
|
multiFileField = Field
|
||||||
|
|
|
@ -109,7 +109,7 @@ library
|
||||||
, cereal >= 0.4
|
, cereal >= 0.4
|
||||||
, cryptohash-cryptoapi >= 0.1
|
, cryptohash-cryptoapi >= 0.1
|
||||||
, crypto-api >= 0.13
|
, crypto-api >= 0.13
|
||||||
, imagemagick
|
-- , imagemagick
|
||||||
, yesod-markdown >= 0.10
|
, yesod-markdown >= 0.10
|
||||||
, blaze-markup >= 0.7
|
, blaze-markup >= 0.7
|
||||||
, wai >= 3.0
|
, wai >= 3.0
|
||||||
|
|
119
stack.yaml
119
stack.yaml
|
@ -1,21 +1,21 @@
|
||||||
flags:
|
flags:
|
||||||
pandoc:
|
|
||||||
https: false
|
|
||||||
time-locale-compat:
|
time-locale-compat:
|
||||||
old-locale: false
|
old-locale: false
|
||||||
packages:
|
packages:
|
||||||
- '.'
|
- '.'
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- HDBC-2.4.0.1
|
- HDBC-2.4.0.1
|
||||||
- HDBC-postgresql-2.3.2.3
|
- HDBC-postgresql-2.3.2.4
|
||||||
|
- HTTP-4000.3.3
|
||||||
- HUnit-1.3.1.1
|
- HUnit-1.3.1.1
|
||||||
- JuicyPixels-3.2.7
|
- JuicyPixels-3.2.7
|
||||||
- JuicyPixels-scale-dct-0.1.1.0
|
- JuicyPixels-scale-dct-0.1.1.0
|
||||||
- QuickCheck-2.8.2
|
- QuickCheck-2.8.2
|
||||||
- ReadArgs-1.2.2
|
- ReadArgs-1.2.2
|
||||||
- SHA-1.6.4.2
|
- SHA-1.6.4.2
|
||||||
- adjunctions-4.2.2
|
- StateVar-1.1.0.4
|
||||||
- aeson-0.11.2.0
|
- adjunctions-4.3
|
||||||
|
- aeson-0.11.2.1
|
||||||
- aeson-compat-0.3.4.0
|
- aeson-compat-0.3.4.0
|
||||||
- aeson-pretty-0.7.2
|
- aeson-pretty-0.7.2
|
||||||
- ansi-terminal-0.6.2.3
|
- ansi-terminal-0.6.2.3
|
||||||
|
@ -24,6 +24,8 @@ extra-deps:
|
||||||
- asn1-encoding-0.9.3
|
- asn1-encoding-0.9.3
|
||||||
- asn1-parse-0.9.4
|
- asn1-parse-0.9.4
|
||||||
- asn1-types-0.3.2
|
- asn1-types-0.3.2
|
||||||
|
- async-2.1.0
|
||||||
|
- attoparsec-0.13.0.2
|
||||||
- authenticate-1.3.3.2
|
- authenticate-1.3.3.2
|
||||||
- auto-update-0.1.3
|
- auto-update-0.1.3
|
||||||
- base-compat-0.9.1
|
- base-compat-0.9.1
|
||||||
|
@ -31,7 +33,7 @@ extra-deps:
|
||||||
- base16-bytestring-0.1.1.6
|
- base16-bytestring-0.1.1.6
|
||||||
- base64-bytestring-1.0.0.1
|
- base64-bytestring-1.0.0.1
|
||||||
- basic-prelude-0.5.0
|
- basic-prelude-0.5.0
|
||||||
- bifunctors-5.1
|
- bifunctors-5.4.1
|
||||||
- blaze-builder-0.4.0.1
|
- blaze-builder-0.4.0.1
|
||||||
- blaze-html-0.8.1.1
|
- blaze-html-0.8.1.1
|
||||||
- blaze-markup-0.7.0.3
|
- blaze-markup-0.7.0.3
|
||||||
|
@ -40,6 +42,7 @@ extra-deps:
|
||||||
- byteorder-1.0.4
|
- byteorder-1.0.4
|
||||||
- bytestring-builder-0.10.6.0.0
|
- bytestring-builder-0.10.6.0.0
|
||||||
- carray-0.1.6.3
|
- carray-0.1.6.3
|
||||||
|
- case-insensitive-1.2.0.6
|
||||||
- cereal-0.5.1.0
|
- cereal-0.5.1.0
|
||||||
- chunked-data-0.3.0
|
- chunked-data-0.3.0
|
||||||
- cipher-aes-0.2.11
|
- cipher-aes-0.2.11
|
||||||
|
@ -47,15 +50,15 @@ extra-deps:
|
||||||
- classy-prelude-conduit-1.0.0
|
- classy-prelude-conduit-1.0.0
|
||||||
- classy-prelude-yesod-1.0.0
|
- classy-prelude-yesod-1.0.0
|
||||||
- clientsession-0.9.1.1
|
- clientsession-0.9.1.1
|
||||||
- cmark-0.5.2.1
|
- cmark-0.5.3.1
|
||||||
- cmdargs-0.10.13
|
- cmdargs-0.10.13
|
||||||
- comonad-4.2.7.2
|
- comonad-5
|
||||||
- conduit-1.2.6.1
|
- conduit-1.2.7
|
||||||
- conduit-combinators-1.0.4
|
- conduit-combinators-1.0.4
|
||||||
- conduit-extra-1.1.13.2
|
- conduit-extra-1.1.13.2
|
||||||
- connection-0.2.5
|
- connection-0.2.5
|
||||||
- constraints-0.8
|
- constraints-0.8
|
||||||
- contravariant-1.3.3
|
- contravariant-1.4
|
||||||
- convertible-1.1.1.0
|
- convertible-1.1.1.0
|
||||||
- cookie-0.4.1.6
|
- cookie-0.4.1.6
|
||||||
- cprng-aes-0.6.1
|
- cprng-aes-0.6.1
|
||||||
|
@ -74,25 +77,26 @@ extra-deps:
|
||||||
- data-default-instances-dlist-0.0.1
|
- data-default-instances-dlist-0.0.1
|
||||||
- data-default-instances-old-locale-0.0.1
|
- data-default-instances-old-locale-0.0.1
|
||||||
- digest-0.0.1.2
|
- digest-0.0.1.2
|
||||||
- distributive-0.4.4
|
- distributive-0.5.0.2
|
||||||
- dlist-0.7.1.2
|
- dlist-0.7.1.2
|
||||||
- dlist-instances-0.1
|
- dlist-instances-0.1
|
||||||
- easy-file-0.2.1
|
- easy-file-0.2.1
|
||||||
- email-validate-2.2.0
|
- email-validate-2.2.0
|
||||||
- enclosed-exceptions-1.0.1.1
|
- enclosed-exceptions-1.0.1.1
|
||||||
- entropy-0.3.7
|
- entropy-0.3.7
|
||||||
- exceptions-0.8.0.2
|
- exceptions-0.8.3
|
||||||
- extensible-exceptions-0.1.1.4
|
- extensible-exceptions-0.1.1.4
|
||||||
- fail-4.9.0.0
|
- fail-4.9.0.0
|
||||||
- fast-logger-2.4.6
|
- fast-logger-2.4.6
|
||||||
- fft-0.1.8.3
|
- fft-0.1.8.3
|
||||||
- file-embed-0.0.9
|
- file-embed-0.0.9
|
||||||
- filemanip-0.3.6.3
|
- filemanip-0.3.6.3
|
||||||
- free-4.12.1
|
- free-4.12.4
|
||||||
- haddock-library-1.2.1
|
- haddock-library-1.4.2
|
||||||
|
- hashable-1.2.4.0
|
||||||
- hex-0.1.2
|
- hex-0.1.2
|
||||||
- highlighting-kate-0.6.2
|
- highlighting-kate-0.6.2
|
||||||
- hjsmin-0.1.5.1
|
- hjsmin-0.2.0.2
|
||||||
- hourglass-0.2.9
|
- hourglass-0.2.9
|
||||||
- hslua-0.4.1
|
- hslua-0.4.1
|
||||||
- hspec-2.2.3
|
- hspec-2.2.3
|
||||||
|
@ -108,83 +112,99 @@ extra-deps:
|
||||||
- http-types-0.9
|
- http-types-0.9
|
||||||
- http2-1.3.1
|
- http2-1.3.1
|
||||||
- image-type-0.1.0.0
|
- image-type-0.1.0.0
|
||||||
- imagemagick-0.0.4.2
|
|
||||||
- iproute-1.7.0
|
- iproute-1.7.0
|
||||||
- ix-shapable-0.1.0
|
- ix-shapable-0.1.0
|
||||||
- kan-extensions-4.2.3
|
- kan-extensions-5.0.1
|
||||||
- keys-3.10.2
|
- keys-3.11
|
||||||
- language-javascript-0.5.14.2
|
- language-javascript-0.6.0.8
|
||||||
- lifted-async-0.9.0
|
- lifted-async-0.9.0
|
||||||
- lifted-base-0.2.3.6
|
- lifted-base-0.2.3.6
|
||||||
- memory-0.10
|
- memory-0.11
|
||||||
- mime-mail-0.4.11
|
- mime-mail-0.4.11
|
||||||
- mime-types-0.1.0.6
|
- mime-types-0.1.0.6
|
||||||
- mmorph-1.0.4
|
- mmorph-1.0.6
|
||||||
- monad-control-1.0.0.4
|
- monad-control-1.0.0.4
|
||||||
- monad-logger-0.3.16
|
- monad-logger-0.3.16
|
||||||
- monad-loops-0.4.3
|
- monad-loops-0.4.3
|
||||||
- monad-unlift-0.2.0
|
- monad-unlift-0.2.0
|
||||||
- mono-traversable-1.0.0.1
|
- mono-traversable-1.0.0.1
|
||||||
- mono-traversable-instances-0.1.0.0
|
- mono-traversable-instances-0.1.0.0
|
||||||
|
- mtl-2.2.1
|
||||||
- mtl-compat-0.2.1.3
|
- mtl-compat-0.2.1.3
|
||||||
- mutable-containers-0.3.2
|
- mutable-containers-0.3.2
|
||||||
- mwc-random-0.13.3.2
|
- mwc-random-0.13.3.2
|
||||||
- nats-1.1.1
|
- nats-1.1.1
|
||||||
|
- network-2.6.2.1
|
||||||
|
- network-uri-2.6.1.0
|
||||||
- nonce-1.0.2
|
- nonce-1.0.2
|
||||||
- optparse-applicative-0.12.0.0
|
- old-locale-1.0.0.7
|
||||||
- pandoc-1.17.1
|
- old-time-1.1.0.3
|
||||||
|
- optparse-applicative-0.13.0.0
|
||||||
|
- pandoc-1.17.2
|
||||||
- pandoc-types-1.16.1
|
- pandoc-types-1.16.1
|
||||||
|
- parsec-3.1.11
|
||||||
- path-pieces-0.2.1
|
- path-pieces-0.2.1
|
||||||
- pem-0.2.2
|
- pem-0.2.2
|
||||||
- persistent-2.5
|
- persistent-2.5
|
||||||
- persistent-postgresql-2.5
|
- persistent-postgresql-2.5
|
||||||
- persistent-sqlite-2.5.0.2
|
- persistent-sqlite-2.5.0.2
|
||||||
- persistent-template-2.5.1.3
|
- persistent-template-2.5.1.6
|
||||||
- pointed-4.2.0.2
|
- pointed-5
|
||||||
- postgresql-libpq-0.9.1.1
|
- postgresql-libpq-0.9.1.1
|
||||||
- postgresql-simple-0.5.2.1
|
- postgresql-simple-0.5.2.1
|
||||||
- prelude-extras-0.4.0.2
|
- prelude-extras-0.4.0.2
|
||||||
- profunctors-5.1.2
|
- primitive-0.6.1.0
|
||||||
|
- profunctors-5.2
|
||||||
- psqueues-0.2.0.3
|
- psqueues-0.2.0.3
|
||||||
- quickcheck-io-0.1.2
|
- quickcheck-io-0.1.2
|
||||||
|
- random-1.1
|
||||||
|
- regex-base-0.93.2
|
||||||
- regex-pcre-builtin-0.94.4.8.8.35
|
- regex-pcre-builtin-0.94.4.8.8.35
|
||||||
- resource-pool-0.2.3.2
|
- resource-pool-0.2.3.2
|
||||||
- resourcet-1.1.7
|
- resourcet-1.1.7.5
|
||||||
- safe-0.3.9
|
- safe-0.3.9
|
||||||
- safe-exceptions-0.1.2.0
|
- safe-exceptions-0.1.2.0
|
||||||
|
- scientific-0.3.4.8
|
||||||
- securemem-0.1.9
|
- securemem-0.1.9
|
||||||
- semigroupoids-5.0.1
|
- semigroupoids-5.1
|
||||||
- semigroups-0.18.0.1
|
- semigroups-0.18.2
|
||||||
- setenv-0.1.1.3
|
- setenv-0.1.1.3
|
||||||
- shakespeare-2.0.7
|
- shakespeare-2.0.11
|
||||||
- silently-1.2.5
|
- silently-1.2.5
|
||||||
- simple-sendfile-0.2.21
|
- simple-sendfile-0.2.21
|
||||||
- skein-1.0.9.4
|
- skein-1.0.9.4
|
||||||
- socks-0.5.4
|
- socks-0.5.4
|
||||||
|
- split-0.2.3.1
|
||||||
|
- stm-2.4.4.1
|
||||||
- stm-chans-3.0.0.4
|
- stm-chans-3.0.0.4
|
||||||
- storable-complex-0.2.2
|
- storable-complex-0.2.2
|
||||||
- streaming-commons-0.1.15
|
- streaming-commons-0.1.15
|
||||||
- stringsearch-0.3.6.6
|
- stringsearch-0.3.6.6
|
||||||
|
- syb-0.6
|
||||||
- system-filepath-0.4.13.4
|
- system-filepath-0.4.13.4
|
||||||
- tagged-0.8.4
|
- tagged-0.8.4
|
||||||
- tagsoup-0.14
|
- tagsoup-0.14
|
||||||
- tagstream-conduit-0.5.5.3
|
- tagstream-conduit-0.5.5.3
|
||||||
- temporary-1.2.0.3
|
- temporary-1.2.0.3
|
||||||
- texmath-0.8.6.4
|
- texmath-0.8.6.5
|
||||||
|
- text-1.2.2.1
|
||||||
|
- tf-random-0.5
|
||||||
- time-locale-compat-0.1.1.1
|
- time-locale-compat-0.1.1.1
|
||||||
- tls-1.3.4
|
- tls-1.3.4
|
||||||
- transformers-base-0.4.4
|
- transformers-base-0.4.4
|
||||||
- transformers-compat-0.4.0.4
|
- transformers-compat-0.5.1.4
|
||||||
- unix-compat-0.4.1.4
|
- unix-compat-0.4.1.4
|
||||||
- unix-time-0.3.6
|
- unix-time-0.3.6
|
||||||
|
- unordered-containers-0.2.7.1
|
||||||
- utf8-string-1.0.1.1
|
- utf8-string-1.0.1.1
|
||||||
- uuid-types-1.0.2
|
- uuid-types-1.0.3
|
||||||
- vault-0.3.0.5
|
- vault-0.3.0.6
|
||||||
|
- vector-0.11.0.0
|
||||||
- vector-algorithms-0.7.0.1
|
- vector-algorithms-0.7.0.1
|
||||||
- vector-instances-3.3.1
|
- vector-instances-3.3.1
|
||||||
- void-0.7.1
|
- void-0.7.1
|
||||||
- wai-3.0.5.0
|
- wai-3.0.5.0
|
||||||
- wai-app-static-3.1.4.1
|
- wai-app-static-3.1.6.1
|
||||||
- wai-extra-3.0.16.1
|
- wai-extra-3.0.16.1
|
||||||
- wai-logger-2.2.7
|
- wai-logger-2.2.7
|
||||||
- warp-3.1.12
|
- warp-3.1.12
|
||||||
|
@ -194,7 +214,7 @@ extra-deps:
|
||||||
- x509-system-1.6.3
|
- x509-system-1.6.3
|
||||||
- x509-validation-1.6.3
|
- x509-validation-1.6.3
|
||||||
- xml-1.3.14
|
- xml-1.3.14
|
||||||
- xml-conduit-1.3.3
|
- xml-conduit-1.3.5
|
||||||
- xml-types-0.3.6
|
- xml-types-0.3.6
|
||||||
- xss-sanitize-0.3.5.6
|
- xss-sanitize-0.3.5.6
|
||||||
- yaml-0.8.15.2
|
- yaml-0.8.15.2
|
||||||
|
@ -207,29 +227,6 @@ extra-deps:
|
||||||
- yesod-persistent-1.4.0.5
|
- yesod-persistent-1.4.0.5
|
||||||
- yesod-static-1.5.0.3
|
- yesod-static-1.5.0.3
|
||||||
- yesod-test-1.5.0.1
|
- yesod-test-1.5.0.1
|
||||||
- zip-archive-0.3.0.2
|
- zip-archive-0.3.0.4
|
||||||
- HTTP-4000.3.3
|
|
||||||
- StateVar-1.1.0.4
|
|
||||||
- async-2.1.0
|
|
||||||
- attoparsec-0.13.0.2
|
|
||||||
- case-insensitive-1.2.0.6
|
|
||||||
- hashable-1.2.4.0
|
|
||||||
- mtl-2.2.1
|
|
||||||
- network-2.6.2.1
|
|
||||||
- network-uri-2.6.1.0
|
|
||||||
- old-locale-1.0.0.7
|
|
||||||
- old-time-1.1.0.3
|
|
||||||
- parsec-3.1.11
|
|
||||||
- primitive-0.6.1.0
|
|
||||||
- random-1.1
|
|
||||||
- regex-base-0.93.2
|
|
||||||
- scientific-0.3.4.8
|
|
||||||
- split-0.2.3.1
|
|
||||||
- stm-2.4.4.1
|
|
||||||
- syb-0.6
|
|
||||||
- text-1.2.2.1
|
|
||||||
- tf-random-0.5
|
|
||||||
- unordered-containers-0.2.7.1
|
|
||||||
- vector-0.11.0.0
|
|
||||||
- zlib-0.6.1.1
|
- zlib-0.6.1.1
|
||||||
resolver: ghc-7.10
|
resolver: ghc-8.0
|
||||||
|
|
Loading…
Reference in a new issue