1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 16:35:17 +00:00

Expose to on server configuration max conversation images width

This commit is contained in:
2021-03-12 19:17:53 +01:00
parent e09da912c4
commit e10402b587
3 changed files with 21 additions and 5 deletions

View File

@ -12,7 +12,7 @@ use crate::api_data::res_count_unread_conversations::ResultCountUnreadConversati
use crate::api_data::res_create_conversation::ResCreateConversation;
use crate::api_data::res_find_private_conversations::ResFindPrivateConversations;
use crate::api_data::user_is_writing_message_in_conversation::UserIsWritingMessageInConversation;
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, MAX_CONV_IMAGE_MESSAGE_HEIGHT, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH};
use crate::controllers::user_ws_controller;
use crate::data::base_request_handler::{BaseRequestHandler, RequestValue};
use crate::data::conversation::NewConversationSettings;
@ -313,7 +313,7 @@ pub fn send_message(r: &mut HttpRequestHandler) -> RequestResult {
thumbnail = Some("file".to_string());
}
path = r.save_post_image("file", "conversation", 2000, 2000)?;
path = r.save_post_image("file", "conversation", MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_IMAGE_MESSAGE_HEIGHT)?;
mime_type = "image/png".to_string();
name = "picture.png".to_string();
}
@ -352,7 +352,7 @@ pub fn send_message(r: &mut HttpRequestHandler) -> RequestResult {
// Attempt to save thumbnail, if it fails we can not save message
let thumbnail = match thumbnail {
None => None,
Some(f) => Some(match r.save_post_image(&f, "conversations-thumb", 300, 300) {
Some(f) => Some(match r.save_post_image(&f, "conversations-thumb", MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT) {
Ok(s) => Ok(s),
Err(e) => {
eprintln!("Failed to save conversation thumbnail! {:#?}", e);