Over the last few days we have started to enable a new smaller version of uploaded photos. You may notice these sometimes because they currently end in -m.jpg
, with the “m” for “medium”. These photos are about 1000x1000, which often translates to about 1/4 of the usual file size.
They are currently used in the Uploads page on the web, and will be used more in the mobile apps later.
For years we’ve had a special photos proxy that can scale and cache photos to any size. These new more explicit medium-sized photos are convenient because they are generated when the post is created, not on-demand later. They can be used in blogs via Hugo templates or from the Micropub API.
From the Micropub API /micropub/media?q=source
, there is a new sizes
field in the JSON like this:
[
{
"url": "https://www.manton.org/uploads/2024/704d2398ba.jpg",
"published": "2024-08-05T02:43:25+00:00",
"alt": "A miniature golf putting green...",
"sizes": {
"medium": "https://www.manton.org/uploads/2024/704d2398ba-m.jpg"
}
}
]
This is not entirely set in stone. We may change it later after feedback from the IndieWeb community. Apps should always gracefully fall back on the main URL if the medium size is not available.
From Hugo parameters:
{{ range .Params.photos_with_metadata }}
<img src="{{ .sizes.medium }}">
{{ end }}