throwing out imagemagick

This commit is contained in:
nek0 2016-08-23 18:20:30 +02:00
parent 53795a448a
commit 8927bf8e32
5 changed files with 76 additions and 69 deletions

View file

@ -94,7 +94,7 @@ postAdminAlbumSettingsR albumId = do
adminAlbumSettingsForm album albumId users
case res of
FormSuccess temp -> do
width <- getThumbWidth $ Just $ L.tail $ fromMaybe "a" $ albumSamplePic temp
width <- getThumbWidth $ albumSamplePic temp
_ <- runDB $ update albumId
[ AlbumTitle =. albumTitle temp
, AlbumShares =. albumShares temp

View file

@ -108,7 +108,7 @@ postAlbumSettingsR albumId = do
else do
return [()]
-- nothing to do here
width <- getThumbWidth $ Just $ L.tail $ fromMaybe ['a'] $ albumSamplePic temp
width <- getThumbWidth $ albumSamplePic temp
_ <- runDB $ update albumId
[ AlbumTitle =. albumTitle temp
, AlbumShares =. newShares

View file

@ -34,13 +34,14 @@ import Yesod
import Numeric (readHex, showHex)
import Network.Mail.Mime
import Text.Blaze.Html.Renderer.Utf8
import Graphics.ImageMagick.MagickWand
import Filesystem.Path.CurrentOS
import Database.Bloodhound
import Network.HTTP.Client
import Network.HTTP.Types.Status as S
import Control.Monad (when)
import Codec.Picture
getUserIdFromText :: T.Text -> UserId
getUserIdFromText tempUserId =
case key of
@ -192,10 +193,19 @@ mediumStaticThumbRoute medium =
getThumbWidth :: MonadIO m => Maybe String -> m Int
getThumbWidth path
| path == Nothing = pure 230
| otherwise = liftIO $ withMagickWandGenesis $ do
(_, w) <- magickWand
readImage w (T.pack $ fromJust path)
getImageWidth w
| otherwise = liftIO $ do
eorig <- readImage $ fromJust path
case eorig of
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 = Field

View file

@ -109,7 +109,7 @@ library
, cereal >= 0.4
, cryptohash-cryptoapi >= 0.1
, crypto-api >= 0.13
, imagemagick
-- , imagemagick
, yesod-markdown >= 0.10
, blaze-markup >= 0.7
, wai >= 3.0

View file

@ -1,21 +1,21 @@
flags:
pandoc:
https: false
time-locale-compat:
old-locale: false
packages:
- '.'
extra-deps:
- 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
- JuicyPixels-3.2.7
- JuicyPixels-scale-dct-0.1.1.0
- QuickCheck-2.8.2
- ReadArgs-1.2.2
- SHA-1.6.4.2
- adjunctions-4.2.2
- aeson-0.11.2.0
- StateVar-1.1.0.4
- adjunctions-4.3
- aeson-0.11.2.1
- aeson-compat-0.3.4.0
- aeson-pretty-0.7.2
- ansi-terminal-0.6.2.3
@ -24,6 +24,8 @@ extra-deps:
- asn1-encoding-0.9.3
- asn1-parse-0.9.4
- asn1-types-0.3.2
- async-2.1.0
- attoparsec-0.13.0.2
- authenticate-1.3.3.2
- auto-update-0.1.3
- base-compat-0.9.1
@ -31,7 +33,7 @@ extra-deps:
- base16-bytestring-0.1.1.6
- base64-bytestring-1.0.0.1
- basic-prelude-0.5.0
- bifunctors-5.1
- bifunctors-5.4.1
- blaze-builder-0.4.0.1
- blaze-html-0.8.1.1
- blaze-markup-0.7.0.3
@ -40,6 +42,7 @@ extra-deps:
- byteorder-1.0.4
- bytestring-builder-0.10.6.0.0
- carray-0.1.6.3
- case-insensitive-1.2.0.6
- cereal-0.5.1.0
- chunked-data-0.3.0
- cipher-aes-0.2.11
@ -47,15 +50,15 @@ extra-deps:
- classy-prelude-conduit-1.0.0
- classy-prelude-yesod-1.0.0
- clientsession-0.9.1.1
- cmark-0.5.2.1
- cmark-0.5.3.1
- cmdargs-0.10.13
- comonad-4.2.7.2
- conduit-1.2.6.1
- comonad-5
- conduit-1.2.7
- conduit-combinators-1.0.4
- conduit-extra-1.1.13.2
- connection-0.2.5
- constraints-0.8
- contravariant-1.3.3
- contravariant-1.4
- convertible-1.1.1.0
- cookie-0.4.1.6
- cprng-aes-0.6.1
@ -74,25 +77,26 @@ extra-deps:
- data-default-instances-dlist-0.0.1
- data-default-instances-old-locale-0.0.1
- digest-0.0.1.2
- distributive-0.4.4
- distributive-0.5.0.2
- dlist-0.7.1.2
- dlist-instances-0.1
- easy-file-0.2.1
- email-validate-2.2.0
- enclosed-exceptions-1.0.1.1
- entropy-0.3.7
- exceptions-0.8.0.2
- exceptions-0.8.3
- extensible-exceptions-0.1.1.4
- fail-4.9.0.0
- fast-logger-2.4.6
- fft-0.1.8.3
- file-embed-0.0.9
- filemanip-0.3.6.3
- free-4.12.1
- haddock-library-1.2.1
- free-4.12.4
- haddock-library-1.4.2
- hashable-1.2.4.0
- hex-0.1.2
- highlighting-kate-0.6.2
- hjsmin-0.1.5.1
- hjsmin-0.2.0.2
- hourglass-0.2.9
- hslua-0.4.1
- hspec-2.2.3
@ -108,83 +112,99 @@ extra-deps:
- http-types-0.9
- http2-1.3.1
- image-type-0.1.0.0
- imagemagick-0.0.4.2
- iproute-1.7.0
- ix-shapable-0.1.0
- kan-extensions-4.2.3
- keys-3.10.2
- language-javascript-0.5.14.2
- kan-extensions-5.0.1
- keys-3.11
- language-javascript-0.6.0.8
- lifted-async-0.9.0
- lifted-base-0.2.3.6
- memory-0.10
- memory-0.11
- mime-mail-0.4.11
- mime-types-0.1.0.6
- mmorph-1.0.4
- mmorph-1.0.6
- monad-control-1.0.0.4
- monad-logger-0.3.16
- monad-loops-0.4.3
- monad-unlift-0.2.0
- mono-traversable-1.0.0.1
- mono-traversable-instances-0.1.0.0
- mtl-2.2.1
- mtl-compat-0.2.1.3
- mutable-containers-0.3.2
- mwc-random-0.13.3.2
- nats-1.1.1
- network-2.6.2.1
- network-uri-2.6.1.0
- nonce-1.0.2
- optparse-applicative-0.12.0.0
- pandoc-1.17.1
- old-locale-1.0.0.7
- old-time-1.1.0.3
- optparse-applicative-0.13.0.0
- pandoc-1.17.2
- pandoc-types-1.16.1
- parsec-3.1.11
- path-pieces-0.2.1
- pem-0.2.2
- persistent-2.5
- persistent-postgresql-2.5
- persistent-sqlite-2.5.0.2
- persistent-template-2.5.1.3
- pointed-4.2.0.2
- persistent-template-2.5.1.6
- pointed-5
- postgresql-libpq-0.9.1.1
- postgresql-simple-0.5.2.1
- prelude-extras-0.4.0.2
- profunctors-5.1.2
- primitive-0.6.1.0
- profunctors-5.2
- psqueues-0.2.0.3
- quickcheck-io-0.1.2
- random-1.1
- regex-base-0.93.2
- regex-pcre-builtin-0.94.4.8.8.35
- resource-pool-0.2.3.2
- resourcet-1.1.7
- resourcet-1.1.7.5
- safe-0.3.9
- safe-exceptions-0.1.2.0
- scientific-0.3.4.8
- securemem-0.1.9
- semigroupoids-5.0.1
- semigroups-0.18.0.1
- semigroupoids-5.1
- semigroups-0.18.2
- setenv-0.1.1.3
- shakespeare-2.0.7
- shakespeare-2.0.11
- silently-1.2.5
- simple-sendfile-0.2.21
- skein-1.0.9.4
- socks-0.5.4
- split-0.2.3.1
- stm-2.4.4.1
- stm-chans-3.0.0.4
- storable-complex-0.2.2
- streaming-commons-0.1.15
- stringsearch-0.3.6.6
- syb-0.6
- system-filepath-0.4.13.4
- tagged-0.8.4
- tagsoup-0.14
- tagstream-conduit-0.5.5.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
- tls-1.3.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-time-0.3.6
- unordered-containers-0.2.7.1
- utf8-string-1.0.1.1
- uuid-types-1.0.2
- vault-0.3.0.5
- uuid-types-1.0.3
- vault-0.3.0.6
- vector-0.11.0.0
- vector-algorithms-0.7.0.1
- vector-instances-3.3.1
- void-0.7.1
- 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-logger-2.2.7
- warp-3.1.12
@ -194,7 +214,7 @@ extra-deps:
- x509-system-1.6.3
- x509-validation-1.6.3
- xml-1.3.14
- xml-conduit-1.3.3
- xml-conduit-1.3.5
- xml-types-0.3.6
- xss-sanitize-0.3.5.6
- yaml-0.8.15.2
@ -207,29 +227,6 @@ extra-deps:
- yesod-persistent-1.4.0.5
- yesod-static-1.5.0.3
- yesod-test-1.5.0.1
- zip-archive-0.3.0.2
- 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
- zip-archive-0.3.0.4
- zlib-0.6.1.1
resolver: ghc-7.10
resolver: ghc-8.0