Comments (8)
I'll find in the array the max by "file_size" and take that
from telegrambotphp.
From https://core.telegram.org/bots/api#message
$data = $telegram->getData();
$caption = $data["message"]["caption"];
from telegrambotphp.
Thanks Sir!
I understood it. But when user sends photo with caption i get two or three items on array. Your function getFile allows get only thumb photo. How i can get original photo when user sends photo + caption. Thanks
Example of log reply when user send photo + caption always diffrent one time 2 items one time three items.
[{"file_id":"AgADAgADH8AxG0vxDwX4JrdhyCFaXPTPgQ0ABKob5To0gmvyUaABAAEC",
"file_size":1750,"file_path":"photo/file_29.jpg","width":90,"height":73},{"file_id":"AgADAgADH8AxG0vxDwX4JrdhyCFaXPTPgQ0ABLumVtYgbe8TUqABAAEC",
"file_size":27040,"width":320,"height":259},{"file_id":"AgADAgADH8AxG0vxDwX4JrdhyCFaXPTPgQ0ABFLSNjs09xgvUKABAAEC","file_size":57840,"width":720,"height":582}],"caption":"15/3000/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435/\u041a\u043e\u0440\u043e\u0431\u043a\u0438/\u0440\u043e\u0437\u0430"}}]
from telegrambotphp.
The different elements in the photoSize array should be the same pic with different sizes.
You can download them all doing something like this (untested)
$photo_array = $message["photo"];
for ($i = 0; $i < count($photo_array); $i++) {
$file_id = $photo_array[$i]["file_id"];
$file = $telegram->getFile($file_id);
$telegram->downloadFile($file["file_path"], "./test_download". $i . ".png");
}
from telegrambotphp.
Thanks!
But I prefered other way beacuse i need one big photo and upload it on server
foreach($photo_array as $item=>$value) { if($value['width'] > 90) { $bigPhoto[] = $value; } }
from telegrambotphp.
How to right way for binding action for file uploading.
My action:
`$result = $telegram->getData();
if($result['message']['photo'] != 0) {
some code
}`
But i've some problems with that way. It works not correctly and exucute through time.
Thanks
from telegrambotphp.
check if isset($result['message']['photo']) && count($result['message']['photo']) > 0
from telegrambotphp.
Thanks it works.
from telegrambotphp.
Related Issues (20)
- Telegram::getChatMembersCount() method
- [BUG]
- Hi~~ @Eleirbag89 pls delete this issue,thanks!
- Web Apps HOT 8
- UpdateCount[BUG] HOT 2
- payment function HOT 1
- you have any video for this bot like tutorial ? HOT 1
- How to make wait for answer HOT 2
- Can you create .phar file for this project HOT 9
- [BUG]
- ErrorException Undefined array key "message" when using funtion UserID() HOT 3
- Formatting options HOT 3
- sendMediaGroup not working! HOT 1
- How to get user_id of the message of a user I reply to? HOT 1
- Add API Support for up to API 6.9 (22.09.2023) HOT 1
- Please Add Forward From Username HOT 1
- My button not a have actions
- how to send sticker HOT 2
- Failed to connect to api.telegram.org port 443 after 21043 ms: Timed out HOT 2
- local-bot-api-server HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegrambotphp.