chrisml's avatar

Can't upload image to Twitter

I'm using https://github.com/thujohn/twitter and trying to upload an image with a tweet, but I'm getting this error and it's very frustrating:

[324] The validation of media ids failed.

Tweeting without media works perfectly fine. It seems to upload the image and fail on posting the tweet.

This is my code, I'm just using the site's logo to test:

$uploaded_media = Twitter::uploadMedia(['media' => File::get(public_path() . '/images/logo.png')]);

Twitter::postTweet(['status' => 'Tweet with an image.', 'media_ids' => $uploaded_media->media_id_string]);

Anyone experienced this before?

0 likes
1 reply
arapmelly's avatar

I got the same error when using png files. Try using jpg it worked for me but I cant explain why. seems to be a bug on png extensions

Please or to participate in this conversation.