Skip to content

cant resize image before NewPhoto func #600

@AdamRussak

Description

@AdamRussak

issue

i am using the tgbotapi.NewPhoto command in the following method:

photo := tgbotapi.NewPhoto(update.Message.Chat.ID, tgbotapi.FilePath(imageLocation))
photo.Caption = ItemValidate
photo.ReplyMarkup = numericKeyboard
sendMessage(bot, photo)

most images are working fine, but some are reciving:
Bad Request: PHOTO_INVALID_DIMENSIONS

{"ok":false,"error_code":400,"description":"Bad Request: PHOTO_INVALID_DIMENSIONS"}

in python, it didn't happen with the same image exactly.

  • i think i can avoid this issue by setting image width and hight manully, how do i do it?
  • or what is the issue here?

to reproduce:

download this image:
will work fine:
https://m.media-amazon.com/images/M/MV5BYzRjMDBiY2YtMDAyOC00OGQwLWE4Y2MtMTVkYTNkMjQ5MTAzXkEyXkFqcGdeQXVyMjMyMzI4MzY@._V1_.jpg

will fail:
https://m.media-amazon.com/images/M/MV5BMWU3Y2RhNTQtNGQxZS00ZWE0LWI5YzQtYzU1MmE4YTE1MDNiXkEyXkFqcGdeQXVyODk4OTc3MTY@._V1_.jpg

and they send it with the NewPhoto method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions