Closed Rybots closed 1 year ago
update_with_media deprecated. My code:
> def send_to_twitter social_pictures, content
> pictures = []
> social_pictures.each do |picture|
> pictures << picture.image.file.path
> end
> media_ids = pictures.map do |filename|
> twitter_client.upload(File.new(filename))
> end.map(&:value)
> twitter_client.update(content, :media_ids => media_ids)
> end
But I have same error
@Rybots I think you need to copy metadata from image_file (StringIO) to your temp_file (Tempfile) as suggested here: https://gist.github.com/janko-m/7cd94b8b4dd113c2c193#file-02-safe-download-commented-rb-L58
Dear, I have the website which user can share some own image with text to Twitter by using Twitter OAuth API. (Ruby:2.3.6,Rails: 5.1.4,‘omniauth-twitter’ gem,Amazon Linux AMI)
and, when User is trying to tweet with an image, (using this)
sometimes the error occurs with following messages
Then, I searched and I found out that If the image is smaller than 10 kb, image path is recognized as Twitter as a character string. So I wrote monkey patch like this.
However, it doesn't work well.Sometimes errors occur yet. Could you please help??
Thanks