path as the temporary file is also tracked by `Plug.Upload{}` and automatically deleted once the request is over.
* `:width` - width of the media in pixels
* `:height` - height of the media in pixels
+ * `:blurhash` - string hash of the image encoded with the blurhash algorithm (https://blurha.sh/)
Related behaviors:
content_type: String.t(),
width: integer(),
height: integer(),
+ blurhash: String.t(),
path: String.t()
}
- defstruct [:id, :name, :tempfile, :content_type, :width, :height, :path]
+ defstruct [:id, :name, :tempfile, :content_type, :width, :height, :blurhash, :path]
defp get_description(opts, upload) do
case {opts[:description], Pleroma.Config.get([Pleroma.Upload, :default_description])} do
|> Maps.put_if_present("height", upload.height)
],
"name" => description
- }}
+ }
+ |> Maps.put_if_present("blurhash", upload.blurhash)}
else
{:description_limit, _} ->
{:error, :description_too_long}
case uploader do
Pleroma.Uploaders.Local ->
- upload_base_url || Pleroma.Web.base_url() <> "/media/"
+ upload_base_url || Pleroma.Web.Endpoint.url() <> "/media/"
Pleroma.Uploaders.S3 ->
bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
end
_ ->
- public_endpoint || upload_base_url || Pleroma.Web.base_url() <> "/media/"
+ public_endpoint || upload_base_url || Pleroma.Web.Endpoint.url() <> "/media/"
end
end
end