Skip to main content

InputMediaAnimation

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

📝 Schema

FieldTypeDescription
typestringType of the result, must be animation
mediastringFile to send. Pass a file_id to send a file that exists on the Bale servers (recommended), pass an HTTP URL for Bale to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name.
thumbnailInputFile, stringOptional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
captionstringOptional. Caption of the animation to be sent, 0-1024 characters after entities parsing
widthIntegerOptional. Animation width
heightIntegerOptional. Animation height
durationIntegerOptional. Animation duration in seconds

⚙️ Get methods

getType()

Retrieves the type of the media, which should always return "animation".

$type = $inputMediaAnimationObject->getType();

getMedia()

Retrieves the media file (either file_id, HTTP URL, or attach reference) to be sent.

$media = $inputMediaAnimationObject->getMedia();

getThumbnail()

Retrieves the thumbnail of the animation file. This will either be a file_id, HTTP URL, or attach reference if uploaded using multipart/form-data.

$thumbnail = $inputMediaAnimationObject->getThumbnail();

getCaption()

Retrieves the caption of the animation to be sent. It returns a string value (0-1024 characters).

$caption = $inputMediaAnimationObject->getCaption();

getWidth()

Retrieves the width of the animation file. If set, this will return an integer value.

$width = $inputMediaAnimationObject->getWidth();

getHeight()

Retrieves the height of the animation file. If set, this will return an integer value.

$height = $inputMediaAnimationObject->getHeight();

getDuration()

Retrieves the duration of the animation file in seconds.

$duration = $inputMediaAnimationObject->getDuration();

➕ More

tip

For further information, refer to the official Bale documentation for more details.