Errors Uploading Chunked Images to Twitter via OAuth.io - twitter

NB: a minimum-viable-example exists here, with text copied from below.
We are unable to reliably upload images to Twitter.
Twitter has a REST API endpoint for uploading chunked images. We are using OAuth.io (documentation here) to interact with Twitter. We are uploading the image as a base64 string.
If we upload an image in a single chunk, then the image uploads to Twitter without any problem. However, if we split the same image into multiple chunks, then Twitter may:
refuse to upload the image, informing us that the Segments do not add up to provided total file size once the FINALIZE command is called;
accept the the image, but display a corrupted image in the tweet.
The error behavior varies based on the individual file used and the chunk size of our upload. However, we have not been able to determine any viable rules to guarantee success, and certain files seem to be more error prone than others.
Without the ability to introspect what OAuth.io is POSTing or what Twitter is receiving, we are unable to determine where the problem may be occurring.
The code to demonstrate this behavior is quite long (~200 lines of JS, not including the base64 images or HTML). I've published a full working example here for people to interact with. The code from the example available on Github.

Related

Zapier: How to post tweets from trello multiple attachments of images?

I am using a zapier zap to post tweet from trello card added to a specific list.
The description part goes to tweet text and attachment image goes to image of tweet.
In case of one image attachment works well. I use zapier formatter to extract an image url from trello card's attachment.
But I want to tweet more than 1 images. In that case zapier pass the multiple attachments as one zipped file contains attached images. So it fails to pass it to the twitter as invalid media format because it is zipped format but not image format just like .jpg, or .png.
How can I implement this?
Thank you in advance.
What you're describing is expected behavior in how the hydration process is handled for multiple images.
You might be able to use a third-party service like - https://zapier.com/apps/convertapi/integrations app to get these files unzipped within the editor.
With that said, afaik, unless you're creating your own private dev Twitter app, the main app only able to accept one image per post at the moment.

Base 64 or Image file to upload for mobile apps IOS using swift

What is the latest sayings and professionals recommendations to use images for mobile apps. I'm very confused. Being a newbie in IOS development... there are always many directions before decision. Can somebody please recommend what kind of files type should I Use. Base64 encoding to directly store into DB or Images and upload them onto the server. if base64? what datatype do you guys recommend? i'm using BLOB is that fine?
This link says we should use base64
But many says. file size is very heigh in base64 than images (JPG or PNG)s.
It depends on the server, many of them have a "file" option with a callback containing the URL, then you just store the file and consume the URL. I really think that base64 is too much unnecessary processing.
The easiest one is Firebase Storage, where you can just put the file as image/jpeg and receive an URL to that image. Another option is Cloudinary, there are many options.
Most apps just download images from URL's and show them as demanded. You can store images anywhere you want, and in your DB you store URLs from them.

Uploading a video to youtube from my swift app

I've been asked to integrate videos into an existing app which previously only let users upload posts with images.
I don't want to host the videos on my own server for the following reasons:
Server Bandwidth
File Size Limits and Storage Space
Slow-Loading Video or Unexpected Pauses During Playback
Issues with converting to specific formats
Piracy
Based off this article:
https://www.wp101.com/10-reasons-why-you-should-never-host-your-own-videos/
So I tried to research into where I could host the files and then I would simply have to store the URL in my db and use a video player to stream the content.
Vimeo and youtube seemed to be the main options I could find.
I'm wondering how best to implement, would I make use of a youtube API and on successful upload, grab the link and upload to my own server? I'm concerned this may be a long process for the end user.
Another problem is I can't see any swift examples (ZERO obj-c experience) of making the http request but perhaps it is still possible but I'd just have to write the code myself? I'm wondering if anyone has implemented anything like this already as I can't find any examples.
Looking at this question:
How do I upload a video to YouTube from within an iOS application?
None of the links in the comments work and the answer directs to the youtube 2.0 API and I'm concerned that this is now deprecated.
Any advice appreciated!

How does Snapchat show text over image

I am working on an iOS app where the users can add description/text when uploading images like Snapchat.
Do they render images and add the text to image so that it becomes part of the image itself or is it shown as a UILabel over the image?
For the 2nd option the text would have to be sent separately to server.
P.S. Just having an argument with Server side programmer and I'm suggesting the 2nd option.
If we check /ph/upload in Snapchat API (last updated 23-12-2013) we can see that you can upload either a photo or a video.
Of course, this is not the latest version (although this is the last documentation I could find) but I am assumming nothing has changed in that regard.
That means the text is inserted to the photo in the mobile client app, not on the server.
In my opinion, you shouldn't base any decisions about your API architecture on Snapchat because it's unlikely you have the same use cases. In general:
Sending data separately is more flexible and makes client implementation simpler.
Rendering data on the client is better for user experience (everything is faster and the user can see the final result) and also it saves a lot of server resources (the more users you have the more this will be visible).

Do i need an api key to access the new freebase images?

I have a database of people in my iOS app with their images being dowloaded from freebase.com Today i noticed that the images are not downloading any more. I checked and i see that google redesigned and reorganized freebase and now the images include a key. Right now i have image url stored in core data like this
http://img.freebase.com/api/trans/image_thumb/m/03s07kd?maxheight=240&maxwidth=300
To use the new format do i have to get an api key and include that with every image request or i can just get the link and change it in my database? I am not making any other calls to the database just the image from the url.
I just tested and i can change the link to
https://www.googleapis.com/freebase/v1/image/m/03s07kd?maxheight=240&maxwidth=300
which works. I am also noticing now that the images are much lower quality then they were before. How do i get the same quality images that i was getting before?
I want to make sure that this won't happen again and do it properly.
Thanks!
There's a whole set of documentation at: https://developers.google.com/freebase/
Basically, as I understand it, if you don't include your own API key, you'll be working off a small pool of quota shared with all other API users who aren't sending keys with their requests. This means it could work in the morning, but not the evening when quota is exhausted or it works some days, but not others.
Don't forget to include the required attribution to Freebase if you aren't already including it.

Resources