generate jxl from png,jpg,gif

This commit is contained in:
rhiannon morris 2023-01-15 21:39:03 +01:00
parent 76ccbe3c7d
commit 0f20753808
3 changed files with 26 additions and 8 deletions

View file

@ -29,17 +29,22 @@ dependSingle' yamlDir indexFile info prefix build nsfw =
where
images = #all if nsfw then #images info else #sfwImages info
paths = map #path images
paths = map #path images
thumb = thumbFile $ thumbnail info
jxls fs = [base <.> "jxl" | f <- fs,
let (base, ext) = splitExtension f,
ext `elem` imgTypes]
imgTypes = words ".png .jpg .gif"
imgFiles0 = thumb : map pageFile paths ++ map bigFile paths
imgFiles = imgFiles0 ++ jxls imgFiles0
dls = mapMaybe #download images
extras = #extras info
dir = build </> prefix </> yamlDir
page = dir </> "index.html"
deps = unwords $ map (dir </>) $
thumbFile (thumbnail info) :
map pageFile paths ++
map bigFile paths ++
dls ++ extras
deps = unwords $ map (dir </>) $ imgFiles ++ dls ++ extras
dependGallery :: GalleryInfo
-> FilePath -- ^ index file

View file

@ -33,7 +33,7 @@ import Data.Text (Text)
import qualified Data.Text as Text
import Data.YAML (FromYAML (..), (.:), (.:?), (.!=))
import qualified Data.YAML as YAML
import System.FilePath ((</>), takeBaseName, takeExtension, splitExtension)
import System.FilePath ((</>), takeBaseName, takeExtension, splitExtensions)
import Data.Bifunctor (second)
@ -244,7 +244,7 @@ bigFile f
addSuffix :: String -> FilePath -> FilePath
addSuffix suf path =
let (pre, ext) = splitExtension path in
let (pre, ext) = splitExtensions path in
pre ++ suf ++ ext