J
J
jazzman72020-08-09 00:07:02
PHP
jazzman7, 2020-08-09 00:07:02

How to upload a picture in telegram from a link without a link?

Hello. I publish posts on the channel in this way.

$ch = curl_init();
    curl_setopt_array(
        $ch,
        array(
            CURLOPT_URL => "https://api.telegram.org/bot" . TELEGRAM_TOKEN . "/sendMessage",
            CURLOPT_POST => TRUE,
            CURLOPT_RETURNTRANSFER => TRUE,
            CURLOPT_TIMEOUT => 10,
            CURLOPT_POSTFIELDS => array(
                "chat_id" => TELEGRAM_CHATID,
                "text" => $msg,
        "parse_mode" => "HTML"
            ),
        )
    );


I want to attach a picture to the post, I used the sendPhoto method, but there the maximum length of the text in the description for the picture is about 1000 characters, I decided to publish posts without a picture, but then I remembered that telegram loads the photo from the link, but there is one but - the link is loaded too.
5f2f13bfecfe7854825562.png
Is there any way to upload an image without a link? or other solutions how to publish posts from 1000 characters with a picture?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2020-08-09
@jazzman7

Make a hidden link at the beginning of the post

$msg = "<a href=\"ссылка на картинку\">\u{00a0}</a>\n" . $msg;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question