Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SendPhoto con file_id #29

Closed
weiddolo opened this issue Jul 19, 2016 · 1 comment
Closed

SendPhoto con file_id #29

weiddolo opened this issue Jul 19, 2016 · 1 comment

Comments

@weiddolo
Copy link

weiddolo commented Jul 19, 2016

Ciao Gabriele Grillo, con la funzione sendPhoto, non riesco a ricavare il file_id dell'immagine.

Carico l'immagine in questo modo:

if (strpos($text, 'curl') !== false){
$content = array('chat_id' => $chat_id, 'photo' => new CURLFile(realpath('assets/uploads/images/01.jpg')), 'caption' => $reply_text);
$telegram->sendPhoto($content);
}

In questo modo il bot mi invierà l'immagine. però anzicche specificare il percorso e quindi far caricare ogni volta al bot una nuova immagine, volevo specificare il file_id. Ma non so come ricavarlo?

Qualche idea?

Grazie per l'eventuale risposta. Preferivo contattarti in privato ma non ho trovato modi per farlo :)

@Eleirbag89
Copy link
Owner

$reply = $telegram->sendPhoto($content);
Dentro reply avrai la risposta di telegram.
La prima volta che vuoi mandare un'immagine devi specificarla usando il path ed effettuare l'upload.
La reply di telegram dovrebbe essere di tipo Message e contenere un array di PhotoSize che a loro volta hanno fra i vari campi il file id che puoi memorizzare e riusare per i futuri sendPhoto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants