Added blurhash.rs to fascilitate blurhashing.
Signed-off-by: Niko <cnotsomark@gmail.com>
This commit is contained in:
parent
80277f6aa2
commit
62180897c0
11 changed files with 621 additions and 7 deletions
|
@ -17,6 +17,7 @@ crate-type = [
|
|||
]
|
||||
|
||||
[features]
|
||||
blurhashing=[]
|
||||
element_hacks = []
|
||||
release_max_log_level = [
|
||||
"tracing/max_level_trace",
|
||||
|
|
|
@ -62,6 +62,27 @@ pub(crate) async fn create_content_route(
|
|||
media_id: &utils::random_string(MXC_LENGTH),
|
||||
};
|
||||
|
||||
#[cfg(feature = "blurhashing")]
|
||||
{
|
||||
if body.generate_blurhash {
|
||||
let (blurhash, create_media_result) = tokio::join!(
|
||||
services
|
||||
.media
|
||||
.create_blurhash(&body.file, content_type, filename),
|
||||
services.media.create(
|
||||
&mxc,
|
||||
Some(user),
|
||||
Some(&content_disposition),
|
||||
content_type,
|
||||
&body.file
|
||||
)
|
||||
);
|
||||
return create_media_result.map(|()| create_content::v3::Response {
|
||||
content_uri: mxc.to_string().into(),
|
||||
blurhash,
|
||||
});
|
||||
}
|
||||
}
|
||||
services
|
||||
.media
|
||||
.create(&mxc, Some(user), Some(&content_disposition), content_type, &body.file)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue