Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Media Repository
  2. *Synapse implementation-specific details for the media repository*
  3. The media repository
  4. * stores avatars, attachments and their thumbnails for media uploaded by local
  5. users.
  6. * caches avatars, attachments and their thumbnails for media uploaded by remote
  7. users.
  8. * caches resources and thumbnails used for URL previews.
  9. All media in Matrix can be identified by a unique
  10. [MXC URI](https://spec.matrix.org/latest/client-server-api/#matrix-content-mxc-uris),
  11. consisting of a server name and media ID:
  12. ```
  13. mxc://<server-name>/<media-id>
  14. ```
  15. ## Local Media
  16. Synapse generates 24 character media IDs for content uploaded by local users.
  17. These media IDs consist of upper and lowercase letters and are case-sensitive.
  18. Other homeserver implementations may generate media IDs differently.
  19. Local media is recorded in the `local_media_repository` table, which includes
  20. metadata such as MIME types, upload times and file sizes.
  21. Note that this table is shared by the URL cache, which has a different media ID
  22. scheme.
  23. ### Paths
  24. A file with media ID `aabbcccccccccccccccccccc` and its `128x96` `image/jpeg`
  25. thumbnail, created by scaling, would be stored at:
  26. ```
  27. local_content/aa/bb/cccccccccccccccccccc
  28. local_thumbnails/aa/bb/cccccccccccccccccccc/128-96-image-jpeg-scale
  29. ```
  30. ## Remote Media
  31. When media from a remote homeserver is requested from Synapse, it is assigned
  32. a local `filesystem_id`, with the same format as locally-generated media IDs,
  33. as described above.
  34. A record of remote media is stored in the `remote_media_cache` table, which
  35. can be used to map remote MXC URIs (server names and media IDs) to local
  36. `filesystem_id`s.
  37. ### Paths
  38. A file from `matrix.org` with `filesystem_id` `aabbcccccccccccccccccccc` and its
  39. `128x96` `image/jpeg` thumbnail, created by scaling, would be stored at:
  40. ```
  41. remote_content/matrix.org/aa/bb/cccccccccccccccccccc
  42. remote_thumbnail/matrix.org/aa/bb/cccccccccccccccccccc/128-96-image-jpeg-scale
  43. ```
  44. Older thumbnails may omit the thumbnailing method:
  45. ```
  46. remote_thumbnail/matrix.org/aa/bb/cccccccccccccccccccc/128-96-image-jpeg
  47. ```
  48. Note that `remote_thumbnail/` does not have an `s`.
  49. ## URL Previews
  50. When generating previews for URLs, Synapse may download and cache various
  51. resources, including images. These resources are assigned temporary media IDs
  52. of the form `yyyy-mm-dd_aaaaaaaaaaaaaaaa`, where `yyyy-mm-dd` is the current
  53. date and `aaaaaaaaaaaaaaaa` is a random sequence of 16 case-sensitive letters.
  54. The metadata for these cached resources is stored in the
  55. `local_media_repository` and `local_media_repository_url_cache` tables.
  56. Resources for URL previews are deleted after a few days.
  57. ### Paths
  58. The file with media ID `yyyy-mm-dd_aaaaaaaaaaaaaaaa` and its `128x96`
  59. `image/jpeg` thumbnail, created by scaling, would be stored at:
  60. ```
  61. url_cache/yyyy-mm-dd/aaaaaaaaaaaaaaaa
  62. url_cache_thumbnails/yyyy-mm-dd/aaaaaaaaaaaaaaaa/128-96-image-jpeg-scale
  63. ```