This is a question translated from
I want to build a simple website that consists merely of image upload and download functionalities. Uploaded images would be processed before users can download them. Is that possible in Hugo?
My answer:
A pure Hugo solution is not possible, since Hugo is a static site generator.
Hugo + Staticman is possible in theory.
- Configure Staticman comment form (tutorial) and Continuous Integration. (Require a GitHub/GitLab account.)
- Prepare Hugo template for image processing.
Encode: prepare a JavaScript to base64 encode image.
Upload: in the Staticman comment form, type in an
<img>
element with the base64 string obtained from the previous step. Submit the form.Download: wait for a moment / approve the pull/merge request. Continuous integraton will call Hugo to execute template code for image processing. Processed image will be displayed in the “comment”, as the screenshot below illustrates.