mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-25 09:45:51 -05:00
Add imeta tag
This commit is contained in:
parent
1cc2d72204
commit
4845093786
36
54.md
36
54.md
|
@ -12,7 +12,9 @@ It uses [URI Fragment](https://en.wikipedia.org/wiki/URI_fragment) that agents (
|
||||||
|
|
||||||
The URI fragment follows [media fragments structure](https://www.w3.org/TR/media-frags/#general-structure). For example, one could use `t=number_of_seconds` to start playing a video at the specified position along with an extra [percent-encoded](https://www.ietf.org/rfc/rfc3986.txt) name-value pair separated by `&` char like `https://xyz.com/a-video.mp4#t=24&a%20name=a%20value`.
|
The URI fragment follows [media fragments structure](https://www.w3.org/TR/media-frags/#general-structure). For example, one could use `t=number_of_seconds` to start playing a video at the specified position along with an extra [percent-encoded](https://www.ietf.org/rfc/rfc3986.txt) name-value pair separated by `&` char like `https://xyz.com/a-video.mp4#t=24&a%20name=a%20value`.
|
||||||
|
|
||||||
The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value`
|
The metadata can be appended to any url, like this [NIP-21](21.md) one: `nostr:nevent1qq...pm#a-metadata-name=a-metadata-value`.
|
||||||
|
|
||||||
|
It is suggested to also add `imeta` tags to events to aid in loading resource placeholders.
|
||||||
|
|
||||||
## NIP-94 File Fragments
|
## NIP-94 File Fragments
|
||||||
|
|
||||||
|
@ -22,12 +24,38 @@ Besides available w3c and proprietary URI fragment usage, nostr uses existing [N
|
||||||
- `#`
|
- `#`
|
||||||
- `dim=3024x4032`
|
- `dim=3024x4032`
|
||||||
- `&`
|
- `&`
|
||||||
- `blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24`
|
- `alt=A%20scenic%20photo%20overlooking%20the%20coast%20of%20Costa%20Rica`
|
||||||
- `&`
|
- `&`
|
||||||
- `alt=Picture%20of%20a%20scenic%20view%20overlooking%20the%20coast%20near%20Uvita%2C%20with%20a%20person%20holding%20a%20coffee%20cup`
|
- `blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24`
|
||||||
|
|
||||||
Multiple array values use repeated names and are positioned in the same order of ocurrence in the tag array. For instance, `["aes-256-gcm", 'i-am-a-key', 'i-am-an-iv']` becomes `aes-256-gcm=i-am-a-key&aes-256-gcm=i-am-an-iv`
|
Multiple array values use repeated names and are positioned in the same order of ocurrence in the tag array. For instance, `["aes-256-gcm", 'i-am-a-key', 'i-am-an-iv']` becomes `aes-256-gcm=i-am-a-key&aes-256-gcm=i-am-an-iv`
|
||||||
|
|
||||||
|
## imeta tag
|
||||||
|
|
||||||
|
Metadata fragments are great for sharing urls with extra embedded metadata. They are also good for copying and pasting a resource's url from one note to a new one without losing its metadata.
|
||||||
|
|
||||||
|
But some clients can prepare image and video placeholders faster if specific fields are present outside of `.content`.
|
||||||
|
For these resources, it is suggested to also add `dim`, `alt` and `blurhash` (e.g. of a specific video frame), if available, to `imeta` tags.
|
||||||
|
|
||||||
|
### Complete example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
{
|
||||||
|
"kind": 1,
|
||||||
|
"content": "What a great place! https://xyz.com/example.jpg#dim=3024x4032&alt=A%20scenic%20photo%20overlooking%20the%20coast%20of%20Costa%20Rica&blurhash=eVF%24%5EOI%3A%24%7BM%7Bo%23*0-nNFxakD-%3FxVM%7DWEWB%25iNKxvR-oetmo%23R-aen%24`",
|
||||||
|
"tags": [
|
||||||
|
[
|
||||||
|
"imeta",
|
||||||
|
"url https://xyz.com/example.jpg",
|
||||||
|
"dim 3024x4032",
|
||||||
|
"alt A scenic photo overlooking the coast of Costa Rica",
|
||||||
|
"blurhash eVF$^OI:${M{o#*0-nNFxakD-?xVM}WEWB%iNKxvR-oetmo#R-aen$"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
// ... other event fields
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Recommended client behavior
|
## Recommended client behavior
|
||||||
|
|
||||||
When uploading images during a new post, clients can collect metadata
|
When uploading images during a new post, clients can collect metadata
|
||||||
|
@ -36,5 +64,5 @@ after the image is uploaded and then include the url with inline metadata in the
|
||||||
When pasting urls during post composition, the client could download the image
|
When pasting urls during post composition, the client could download the image
|
||||||
and add some metadata before the post is sent.
|
and add some metadata before the post is sent.
|
||||||
|
|
||||||
Clients can use `alt` fragment to add accessible text for people who prefer not to
|
Clients can use `alt` value to add accessible text for people who prefer not to
|
||||||
load images, visibility-impaired users, or text clients.
|
load images, visibility-impaired users, or text clients.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user