summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haunt/README.md2
-rw-r--r--haunt/jakob/dynamic/captcha.scm12
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))