nips/92.md

46 lines
1.5 KiB
Markdown
Raw Normal View History

NIP-92
2023-11-27 22:47:04 +00:00
======
Media Attachments
-----------------
2023-11-27 22:47:04 +00:00
Media attachments (images, videos, and other files) may be added to events by including a URL in the event content, along with a matching `imeta` tag.
`imeta` ("inline metadata") tags add information about media URLs in the event's content. Each `imeta` tag SHOULD match a URL in the event content. Clients may replace imeta URLs with rich previews.
2023-11-27 22:47:04 +00:00
The `imeta` tag is variadic, and each entry is a space-delimited key/value pair.
Each `imeta` tag MUST have a `url`, and at least one other field. `imeta` may include
2024-02-03 01:28:57 +00:00
any field specified by [NIP 94](./94.md). There SHOULD be only one `imeta` tag per URL.
2023-11-27 22:47:04 +00:00
## Example
```json
{
"content": "More image metadata tests dont mind me https://nostr.build/i/my-image.jpg",
"kind": 1,
"tags": [
[
"imeta",
"url https://nostr.build/i/my-image.jpg",
"m image/jpeg",
2023-11-27 22:47:04 +00:00
"blurhash eVF$^OI:${M{o#*0-nNFxakD-?xVM}WEWB%iNKxvR-oetmo#R-aen$",
"dim 3024x4032",
"alt A scenic photo overlooking the coast of Costa Rica",
"x <sha256 hash as specified in NIP 94>",
2024-02-03 01:28:57 +00:00
"fallback https://nostrcheck.me/alt1.jpg",
2023-11-27 22:47:04 +00:00
"fallback https://void.cat/alt1.jpg"
]
]
}
```
## Recommended client behavior
2024-02-01 21:52:52 +00:00
When uploading files during a new post, clients MAY include this metadata
after the file is uploaded and included in the post.
2023-11-27 22:47:04 +00:00
2024-02-03 01:28:57 +00:00
When pasting URLs during post composition, the client MAY download the file
2023-11-27 22:47:04 +00:00
and add this metadata before the post is sent.
The client MAY ignore `imeta` tags that do not match the URL in the event content.