Post image base64 from iOS to twitter using request.js - twitter

I am working on iOS. In my app user can take photo and upload from Library then it will store as image base64 in database. I want to post this image into Twitter when I select from database. But I always get error message below
{"errors":[{"code":189,"message":"Error creating status."}]}'
I have found a post below really familiar my problem but I still could not make it works.
Twitter update with media with request.js
Much appreciate for your help!

Finally, I found this solution under this post:
Twitter image upload error : media parameter is missing
But one thing to note: make sure your image base64 is not contained full path. This driven me very crazy until I found it. Real example for me
var imageBase64 = data:image/jpeg;base64,4793748374837493749374937434b3b4398498343749374739479374739473947394347373479374334793748374837493749374937434b3b4398498343749374739479374739473947394347373479374334793748374837493749374937434b3b4398498343749374739479374739473947394347373479374334793748374837493749374937434b3b43984983437493747394793747394739473943473734793743...................................................................7979
It is not working. So I have to split as below:
var splitImageBase64 = imageBase64.split(",")[1];
Then it works.
I hope this may help someone else.

Related

Generating download link for youtube video with PHP but filename always saving as videoplayback.mp4

I'm tyrying to create a youtube video downloader script for education purpose. Everything is working fine and link generating but the problem is. it is alway's saving the video as videoplayback.mp4 , But i want to save video as the title of youtube video. How can i do that any idea or knowledge will you share with me please ? Thanks in Advance :)
Currently this kind of link generating with my script:
https://r5---sn-ax8xaj5ggpxg-q5je.googlevideo.com/videoplayback?ipbits=0&signature=962BE0E0565BE4A1C47228B9915BCB8F1CFEB960.9F6BB2DB759AEA92819A21B1D7169934E2029F12&key=yt6&itag=18&ratebypass=yes&expire=1493475511&dur=866.382&pl=24&gir=yes&pcm2=yes&sparams=clen,dur,ei,gir,id,initcwndbps,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,pcm2,pl,ratebypass,requiressl,source,upn,expire&beids=[9466594]&ip=103.250.70.10&lmt=1404765005406941&upn=3jfn7T_trrk&id=o-AIgDAd5Kx005dV22eO8I0kxdhqnMlelHM82MUR6361GG&ei=V0wEWdomgd6jA_7BiQg&initcwndbps=1491250&mn=sn-ax8xaj5ggpxg-q5je&mm=31&requiressl=yes&clen=17929313&mime=video/mp4&source=youtube&ms=au&mv=m&mt=1493453844
I'm adding title with this but it's not downloading video with the title
If you are using PHP to do all your work, then you can rename the file.
You should have the api request info for the video, such as name, id and such. So save the name in a variable and use it to rename the video.
Some basic info HERE to start from.
But you can find plenty of examples around renaming on Stackoverflow
You may user title tag at last of the your url. simply like:
https://r1---sn-npoe7ne6.googlevideo.com/videoplayback?c=xxxxxx&title=THIS+ONE+THING+COMPLETES+YOUR+ENTIRE+SALAH
Example: https://r1---sn-npoe7ne6.googlevideo.com/videoplayback?c=WEB&ei=PbcrXNPYN8j8DbS3g6gJ&signature=7158A95D1D19CE23E5927C5BA269FB93416BE9C3.3013C04B8A60583BE3976207ECC46104DA6231C5&ratebypass=yes&dur=78.135&itag=22&lmt=1546275183213302&key=cms1&expire=1546390430&beids=9466587&sparams=dur,ei,expire,id,ip,ipbits,itag,lmt,mime,mip,mm,mn,ms,mv,pl,ratebypass,requiressl,source&ipbits=0&pl=24&mime=video/mp4&id=o-APHRf9RA8ZFNEcdOCNFsj9WVumGp7BSSD5X3KXyvg0yF&source=youtube&txp=5432432&requiressl=yes&ip=107.178.194.200&fvip=1&extension=mp4&mip=119.30.38.95&redirect_counter=1&cm2rm=sn-bg5hxxo2ivox-q5jz7e&fexp=9466587,23763603&req_id=1d7d8e10b833a3ee&cms_redirect=yes&mm=29&mn=sn-npoe7ne6&ms=rdu&mt=1546368708&mv=m&title=THIS+ONE+THING+COMPLETES+YOUR+ENTIRE+SALAH
Now video will save with
THIS ONE THING COMPLETES YOUR ENTIRE SALAH.mp4
I think it will help you.

Upload to s3 from react-native CameraRoll

Considering using react-native-uploader to upload from iOS CameraRoll to s3. My end goal is to allow users to select an image from CameraRoll and post it on an api-based chat (sendbird). Based on the documentation, for react-native-uploader, though, it doesn't seem like it returns the s3 url in the response. Does anyone know if there's a way to get this back in the response? Perhaps I be approaching another way entirely?
Part of the rationale for this approach is that it's similar to how it works when a file is uploaded on the web-based version of the chat. We use file-uploader, then we post the message to sendbird using the s3 version of the url. Appreciate the help.
Ended up using react-native-aws3 instead. It was very straight forward.

Get first Google Image Web service

I'm building an iOS app and I need somewhere to get images from Google image. Let's say I'm looking for "iPhone 5s", i'd like to get the first Google image result for this research.
Is that any way to achieve this ? Maybe by building the "right" URL ?
Okay, I found This useful link, how ever it is not returning the first image, but i hope it cam be fixed. see if it is useful. Go through Sending a basic query, Here they have created a request which response into JSON format from which you can get what you need.
Hope it will be helpful.

Google Docs Thumbnails link missing on upload without conversion

I have been using the Gdocs API to upload images without conversion. In the response, I used to see a thumbnail entry under feed.entry.link[x]. This appears to be missing since 2 days ago. Does anyone know if a change has been made to the API? Is there an alternate method of getting the thumbnail URL of an uploaded file?
Thanks!
Roderick Forsythe
I'm not aware of any change to the API, the thumbnail should still be available as the link with rel="http://schemas.google.com/docs/2007/thumbnail".
Can you show us your request and the response which doesn't include the thumbnail link?
EDIT: It takes a short amount of time before the thumbnail gets generated and you might not get it in the response of the creation request. It will show up if you GET the resource after you create it.

Upload image and text data in iphone

Hi stackoverflow friends
I want to upload text along with image to the webserver. I saw so many examples for uploading images to webserver but nobody explains how to send text from a uitextField along with image.
All of them points this link
http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/
This link gives only how to upload images only. I want to send some text values along with this. Could you please send me some example code.
Any help is Appreciable
I recommend you try ASIHTTPRequest. It allows you to easily accomplish such a task. You can create a PHP file that will receive your data via POST - ASIHTTPRequest provides some easy to use methods for this.
See here.
you can Use Evernote API for this purpose

Resources