Statically generated sites are cool but when combined with Doing Images on the Internet there are some hackles that I could use computers to fix.
First, if you want the image to have a thumbnail and full-size: you could just download the whole thing then use CSS to adjust the width, but I like what Blogspot did and had a small version embedded that you could click through for the full-size.
So for every image, you probably want it in two sizes.
Then you have to put it in the correct
Then you have to link to it correctly, with an
<a> tag to link to the
Then you have to generate the markup for a caption if you want a cute one.
Finally, you want those images optimized for the internet.
img-insert, does as much of this as possible for you.
- You'll need
magickas a shell command (ImageMagick, you can
brew update && brew install imagemagick).
- You'll want
jpegtran, which is already installed on Macs IIRC.
brew install optipngworks).
- Ditto being on a UNIX-ey enough system to
cpto shell because OCAML IS AWESOME AND DOESN'T HAVE SIMPLE FILE COPY. They do have unlink and rename though, oddly
img-insert <file> will, by default:
static/img/<year>/<month>/<file>directory structure if it doesn't exist (so you can easily
cp -r static/* <dest>/static/*).
If the image is wider than we want to allow our max width (say, 800px), we
- use ImageMagick to resize the image to the max width
- place another copy of
<file>in the new directory, so there's
Write to stdout markup that you can paste in the post, like
<div> <a href="PATH_FULL" target="_blank"><img src="PATH" alt="FILLME" style="display: block; margin: 10px auto" /</a> <p style="text-align: center; font-style: italic; font-size: small">Caption me</p> </div>
- Support multiple images to make an album or somesuch.
Yeah why not.
Edit: oh right lol.