mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2026-02-05 00:01:23 +01:00
service/media: use upload_thumbnail() in get_thumbnail()
This commit is contained in:
parent
c1ea25e1e0
commit
0cf2499e5e
1 changed files with 10 additions and 8 deletions
|
|
@ -327,14 +327,16 @@ impl Service {
|
||||||
|
|
||||||
debug!("Saving created thumbnail");
|
debug!("Saving created thumbnail");
|
||||||
|
|
||||||
// Save thumbnail in database so we don't have to generate it
|
let meta = self
|
||||||
// again next time
|
.upload_thumbnail(
|
||||||
let thumbnail_key =
|
mxc,
|
||||||
self.db.create_file_metadata(mxc, width, height, &meta)?;
|
meta.content_disposition,
|
||||||
|
meta.content_type,
|
||||||
let path = services().globals.get_media_file(&thumbnail_key);
|
width,
|
||||||
let mut f = File::create(path).await?;
|
height,
|
||||||
f.write_all(&thumbnail_bytes).await?;
|
&thumbnail_bytes,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(Some((meta, thumbnail_bytes.clone())))
|
Ok(Some((meta, thumbnail_bytes.clone())))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue