$data['chat_id'] = $query->getMessage()->getChat()->getId();
$path = realpath('/Calendar.png');
Request::sendPhoto($data, $path);
Hi, i used Request::sendPhoto($data, $path) for send photo from local ,but don't send photo to user.
$telegram->setUploadPath(__DIR__ . "/Uploads");
$data = [
'chat_id' => $chat_id
];
$result = Request::sendPhoto($data, $telegram->getUploadPath() . "/image.jpg");
Hi!
I think the path to the file is wrong. Are you sure the path to Calendar.png is correct? It's searching for it in the / root folder, not the current one.
Try this if the file is in the current folder:
$path = realpath(__DIR__ . '/Calendar.png');
You can also enable logging to help find the problem.
Edit: @imidazil beat me to it
@noplanman @imidazil i tried many paths but not solve my problem ( __DIR__ or __FILE__ )
do you test SendPhoto to your project with local photo?
i checked error log and don't have any error
Maybe you're not using newest library version?
Before calling Request::sendPhoto, add this line to make sure that the path is valid.
Longman\TelegramBot\TelegramLog::debug($path);
Then check your debug log file and check that the correct path is output.
As @jacklul mentions, what version of the library are you using?
Also, remember to return the result at the end of your commands execute() method.
I assume that all other commands work properly as they should?
@jacklul i got it in 17 jul 2016.
@noplanman i checked debug log, i faced with Bad Request: there is no photo in the request error.
all of commands work properly.
Ok, then the version will be the problem.
The photo sending was fixed in version 0.35, you probably still have 0.34.
When you run the /help command, it tells you which version you have.
thanks @noplanman , i should update my akalongman to .035
Most helpful comment
thanks @noplanman , i should update my akalongman to .035