Browse Source

add /storage/thumb/media/:slug defroute (re-added).

I think I had a version of this route but I deleted it -- can't
remember if it wasn't needed or didn't work as intended at the
time. Anyway, this commit makes it part of the code-base (again).

The function provides the website to use the automatically generated
thumbnails -- when a user uploads the an image to /storage/media --
instead of the full-sized image. This should help reduce download
times if a list of uploaded image are several Mega Bytes  and being
viewed at once -- like an index page for example.
stable
Craig Oates 2 years ago
parent
commit
e33ac9af0a
  1. 9
      src/web.lisp

9
src/web.lisp

@ -759,6 +759,15 @@
(nera:get-storage-file :slug slug))))
(on-exception *web* 404)))
(defroute ("/storage/thumb/media/:slug" :method :GET) (&key slug)
(let ((storage-file (nera:get-storage-file :slug slug)))
(if storage-file
`(200 (:content-type ,(files::file-type-of storage-file))
,(storage:open-binary-file
"" "media"
(format nil "thumbnail-~a" (files::name-of storage-file))))
(on-exception *web* 404))))
(defroute ("/storage/thumb/archive/:slug" :method :GET) (&key slug)
(if (nera:get-archive-entry :slug slug)
(let ((archive-entry (nera:get-archive-entry :slug slug)))

Loading…
Cancel
Save