diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2022-12-04 14:52:54 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2022-12-04 14:53:05 -0500 |
| commit | f7a4045be79aa0f77b132d646c2f68852c2f62fc (patch) | |
| tree | 1126467f2e0ee1cd0bd2920844d9168f13e80a93 | |
| parent | c3a024d28aac553c01acfedf1981afe86f2ece0e (diff) | |
[dynamic] Use dvipng instead of ImageMagick
| -rw-r--r-- | haunt/README.md | 2 | ||||
| -rw-r--r-- | haunt/jakob/dynamic/captcha.scm | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/haunt/README.md b/haunt/README.md index 6aff7c3..a20189a 100644 --- a/haunt/README.md +++ b/haunt/README.md @@ -83,7 +83,7 @@ Before running the API server, the following databases will need to be created: - GNU Guile `>= 2.2.7` - `guile-gcrypt >= 0.3.0` - `guile-json >= 4.7.2` -- `imagemagick` +- `latex` and `dvipng` - PostgreSQL `>= 14.0` [squee](https://notabug.org/cwebber/guile-squee/) is currently vendored at `haunt/squee.scm`. diff --git a/haunt/jakob/dynamic/captcha.scm b/haunt/jakob/dynamic/captcha.scm index b71bb23..d8b3d56 100644 --- a/haunt/jakob/dynamic/captcha.scm +++ b/haunt/jakob/dynamic/captcha.scm @@ -203,13 +203,11 @@ internally-defined `time-to-live-seconds'." \\end{varwidth} \\end{document} " src))) - (unless (eqv? 0 (status:exit-val (system "pdflatex formula.tex"))) - (error "Cannot generate PDF" #f)) - (let* ((port (open-input-pipe "convert -density 300 formula.pdf -quality 90 png:-")) - (data (get-bytevector-all port))) - (unless (eqv? 0 (status:exit-val (close-pipe port))) - (error "Cannot generate PNG" #f)) - data))) + (unless (eqv? 0 (status:exit-val (system "latex formula.tex"))) + (error "Cannot generate DVI" #f)) + (unless (eqv? 0 (status:exit-val (system "dvipng -D 300 formula.dvi"))) + (error "Cannot generate PNG" #f)) + (call-with-input-file "formula1.png" get-bytevector-all))) (define (new-captcha!) (let* ((lower-bound (random 10)) |