basically recode images

This commit is contained in:
B. Petersen
2020-06-05 21:19:12 +02:00
parent 5d1623b98f
commit 191009372b
3 changed files with 48 additions and 1 deletions

View File

@@ -1332,6 +1332,12 @@ async fn prepare_msg_blob(context: &Context, msg: &mut Message) -> Result<(), Er
.ok_or_else(|| {
format_err!("Attachment missing for message of type #{}", msg.viewtype)
})?;
if msg.viewtype == Viewtype::Image {
if blob.recode_to_image_size(context).await.is_err() {
warn!(context, "Cannot recode image, using original data");
}
}
msg.param.set(Param::File, blob.as_name());
if msg.viewtype == Viewtype::File || msg.viewtype == Viewtype::Image {