(defpackage nefarious
(:use :cl :cl-gd))
(in-package :nefarious)
(defvar *nefarious-counter* 0)
(defun http-header (header value)
(setf (lack.response:response-headers *response*)
(append (lack.response:response-headers *response*)
(list header value))))
(setf (ningle:route maxiblog::*app* "/nefarious")
(lambda (params)
(setf *nefarious-counter* (1+ *nefarious-counter*))
(http-header :content-type "image/png")
(with-image-from-file (base #P"/usr/local/www/todayiwilllaunchmyinfantsonintoorbit.com/static/nefarious.png")
(let* ((width (image-size base))
(text-color (allocate-color 0 128 0 :image base))
(text (format nil "~d" *nefarious-counter*))
(bounding-rect (draw-freetype-string 0 0 text
:font-name #P"/usr/local/www/todayiwilllaunchmyinfantsonintoorbit.com/static/_decterm.ttf"
:point-size 40
:color text-color
:do-not-draw t
:image base))
(text-width (aref bounding-rect 2))
(x-pos (- (floor width 2) (floor text-width 2))))
(draw-freetype-string x-pos 144 text
:font-name #P"/usr/local/www/todayiwilllaunchmyinfantsonintoorbit.com/static/_decterm.ttf"
:point-size 40
:color text-color
:image base)
(flexi-streams:with-output-to-sequence (s)
(write-png-to-stream s :image base))))))
It is dual-licensed under the STRONGEST PUBLIC LICENSE and Big Bill Hell's License.

