mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +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");
|
||||
|
||||
// Save thumbnail in database so we don't have to generate it
|
||||
// again next time
|
||||
let thumbnail_key =
|
||||
self.db.create_file_metadata(mxc, width, height, &meta)?;
|
||||
|
||||
let path = services().globals.get_media_file(&thumbnail_key);
|
||||
let mut f = File::create(path).await?;
|
||||
f.write_all(&thumbnail_bytes).await?;
|
||||
let meta = self
|
||||
.upload_thumbnail(
|
||||
mxc,
|
||||
meta.content_disposition,
|
||||
meta.content_type,
|
||||
width,
|
||||
height,
|
||||
&thumbnail_bytes,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(Some((meta, thumbnail_bytes.clone())))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue