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

"[Error]: Photo has unsupported extension", for remote files. #68

Closed
ping opened this issue Nov 29, 2015 · 3 comments
Closed

"[Error]: Photo has unsupported extension", for remote files. #68

ping opened this issue Nov 29, 2015 · 3 comments

Comments

@ping
Copy link

ping commented Nov 29, 2015

Was testing the support for remote files added in 67e17a5 and got an error [Error]: Photo has unsupported extension.

$tg = new Api($telegram_token);
$img_url = 'https://www.instagram.com/p/-kfo63BQes/media/?size=l';
$response = $tg->sendPhoto(
    array('chat_id' => $chat_id
        , 'photo' => $img_url
        , 'caption' => $my_caption)
);

This can be worked around by artificially adding a fake param x=.jpg making it
$img_url = 'https://www.instagram.com/p/-kfo63BQes/media/?size=l&x=.jpg';

In my opinion, there shouldn't be file extension checks for remote files because an image/video url can be in any format.

@irazasyed
Copy link
Owner

That check is from Telegram Bot API servers and has got nothing to do with this SDK. That's something we can't really control. If they say it's not supported, then its not and you need to provide the one which is supported.

Besides that, The SDK won't do auto redirect. So instead of providing that link, you could rather provide a direct link to the image like this (Same URL which you provided above):

https://igcdn-photos-e-a.akamaihd.net/hphotos-ak-xft1/t51.2885-15/e35/12301416_855648747889404_1852916307_n.jpg

This should work fine.

@ping
Copy link
Author

ping commented Nov 29, 2015

@irazasyed Thanks for the clarification.

However, the redirect works fine in my testing with https://www.instagram.com/p/-kfo63BQes/media/?size=l&x=.jpg. There was no need to provide the direct image link.

@irazasyed
Copy link
Owner

No problem and if you say it does redirect, then that's good then. 👍

I didn't test that fully. It's still WIP.

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