service/media: use upload_thumbnail() in get_thumbnail()

This commit is contained in:
Lambda 2024-09-01 15:48:05 +00:00
parent c1ea25e1e0
commit 0cf2499e5e

View file

@ -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())))
} }