Lightweight image host
I’d like to start hosting my own images in one central spot, maybe for all my websites. This would have three benefits:
- It would keep binary files out of the repo for any version-controlled flat-file sites.
- I wouldn’t have to think about implementing image management in each separate project.
- There would be a single workflow for uploading and using images across all sites.
Components
I have in mind a few simple parts:
- A Racket application (or PHP script) for uploading images. This would sit behind basic HTTP auth (over SSL of course). The entire page would be a drag and drop target for files.
- Images would be broken out into various common sizes and optimized via ImageMagick or TinyPNG API call. Also stripping out any EXIF data. This would happen either right at upload time or via a cron job.
- There would be another endpoint (either in the Racket app or implemented as another PHP script) that lists all uploaded images in a sortable table, just using a directory listing of a particular folder. Click on an image and a popup shows the image and quick-copy links to each size variant in Markdown, HTML, and Pollen markup formats. This part could be public.
- Eventually: a gallery view
I originally thought to just do it in PHP for speed and stupid simplicity. I’ve resisted learning how to and practicing writing web apps in Racket, but I'm now feeling more sanguine about it.