Open dshanske opened 5 years ago
I plan to support this in Micro.blog as soon as there's a recommendation for what the response looks like. I'd prefer to have as few required properties as possible… Maybe just file URL and date, and optionally width/height for images if available.
@dshanske Does the WordPress plugin support this? I'm adding it to Micro.blog and the only thing I'm wondering about is the name for the date/time field. In #13 the example was date_time
, but Micropub usually uses published
.
Not yet, I documented these off the wiki.. published makes more sense as that is the proper mf property
Thanks @dshanske. Here's what my response looks like in Micro.blog right now, from /micropub/media?q=source
:
{
"items": [
{
"url": "https://www.manton.org/uploads/2020/058fa92305.png",
"width": 1200,
"height": 816,
"published": "2020-05-27T14:14:09+00:00"
},
{
"url": "https://www.manton.org/uploads/2020/7a57980ca2.jpg",
"width": 1800,
"height": 1800,
"published": "2020-05-20T02:22:09+00:00"
}
]
}
It also supports limit
and offset
parameters.
Going to look into implementing the response bit at https://git.jacky.wtf/indieweb/koype/issues/214
(Originally published at: https://v2.jacky.wtf/post/46bcf84e-7968-409b-b1a9-2c5f756331ff)
Agreement at the Micropub Pop-Up Session 2020 was to implement q=source with the response noted in #13. It would be subject to the proposed #35 and #36
My media endpoint now supports q=source
and returns the latest 10 files uploaded.
{
"items": [
{
"url": "https://media.aaronpk.com/2020/07/file-20200726XXX.jpg",
"published": "2020-07-26T09:51:11-07:00",
"mime_type": "image/jpeg"
},
{
"url": "https://media.aaronpk.com/2020/07/file-20200726XXX.jpg",
"published": "2020-07-26T08:49:24-07:00",
"mime_type": "image/jpeg"
}
]
}
The files are ordered newest first. It will only ever return a maximum of 10, but a client can request a limit using limit=1
to return up to 10 files.
Quill now queries the media endpoint to find the most recent uploaded file using ?q=source&limit=1
. It expects to find a url
, and if there is a published
field then it will only display the photo if it was uploaded in the last 5 minutes.
Micro.blog has been updated with support for limit
and offset
in the media endpoint. I've also simplified the response to only return url
and published
until there is a convention for other photo properties like dimensions, etc.
This query is supported by Indiekit.
It currently returns this object for a file:
{
"basename": "3uv8j",
"ext": "jpg",
"filename": "3uv8j.jpg",
"originalname": "photo.jpg",
"content-type": "image/jpeg",
"published": "2022-11-07T17:13:16.792Z",
"post-type": "photo",
"url": "https://getindiekit.github.io/sandbox/media/photos/2022/11/07/3uv8j.jpg"
}
This is a direct dump of properties from the database, but in retrospect, think I’ll remove some of those unneeded file name properties and simplify it to this:
{
"content-type": "image/jpeg",
"published": "2022-11-07T17:13:16.792Z",
"post-type": "photo",
"url": "https://getindiekit.github.io/sandbox/media/photos/2022/11/07/3uv8j.jpg"
}
For videos in Micro.blog, we're adding a poster
field for a still frame image from the video:
{
"url": "…something.mov",
"poster": "…something.png",
"published": "…"
}
Still haven't added post type or dimensions because everyone seems to be handling that a little differently.
Resuming this discussion from last year… Has anyone experimented with adding fields to the media q=source
response to point to different sizes of the image? For example, a medium-sized version of the image or smaller thumbnail. I thought I had seen an example of this in the wild but can't find it here or in the wiki.
I'm tempted to do something like:
{
"url": "…something.jpg",
"sizes": {
"medium": "..something-m.jpg"
}
}
It could be more complicated than that including the actual dimensions, but I really want to keep this simple.
Related #4
This is an implementation of the same feature proposed for the micropub endpoint, currently referenced on the Media Endpoint wiki page. https://indieweb.org/micropub_media_endpoint#Query_media_by_URL
The return would be an items property with the responses from #13