Answer the question
In order to leave comments, you need to log in
How to make a round video from a square video when uploading to a telegram bot?
How to turn a square video into a round one? Maybe the question is not correct, the documentation says that the round video 'sendVideoNote' can be uploaded either via file_id or Content-Type:multipart/form-data with file_id is understandable, but how to upload from a square video via a link and multipart/form-data to get a round one does not come out I made a function and if you download via the link, it loads a square without a caption but already as a video but not as a video_note, maybe something is wrong in the function or how it's done here is my function
Как из квадратного видео делать круглое? Может вопрос не правильный, в документации написано что круглое видео 'sendVideoNote' можно подгружать или через file_id или Content-Type:multipart/form-data с file_id понятно а вот как из квадратного загружая через ссылку и multipart/form-data чтоб вышло круглое невыходит Я сделал функцию и если загружать через ссылку загружается загружается квадратное без caption но уже как video но не как video_note, может чтот не так в функции или как это делается вот моя функция
`$path = $site."/bot/video/video1.mp4";
$file_id = "DQACAgIAAxkBAAIBMV_bLnunyi1vlMqDiSkH6FKHIiixAAI_CwACdud4Sq4xIK6CuC5eHgQ";
# Формируем массив для отправления в телеграм
$out = send_message($method = 'sendVideoNote',
$params = array('chat_id' => $chat_id,
//'video_note' => $file_id ));
'video_note' => $path));`
//'video_note' => new CURLFile(realpath($path))));`
`function send_message($method, $params, $headers = [] ){
$url = 'https://api.telegram.org/bot' . TOKEN . '/' . $method;
// Отправить сообщение
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge(array("Content-Type:multipart/form-data"), $headers));
$result = curl_exec($ch);
curl_close($ch);
return (json_decode($result, true) ? json_decode($result, true) : $result);
}`
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question