How to upload photo to image hosting website programmatically? - ios

Is there any way to upload photo programmatically from phone to any photo hosting website(any suggestion for a photo hosting site?)? I need to get the URL only for the uploaded photo to use it on my app. How do you do that?

You can use a service that offer some API like imgur.
You can download the library and see a snippet of code to implement the upload, here on the imgur github page.

Related

GameCenter get GKPlayer photo URL

How can I access the GameCenter player's photo URL? I know about loadPhotoForSize but it seems to return UIImage. I need the URL as I would like to send this URL to my backend and show this photo for users from non-iOS devices.
There is no available GameCenter player's photo URL. It may exist right now, but Apple can change it any moment. And it is not in open access.
Correct way to show player's photo on another non-iOS platforms is to upload this photo to your game servers. Use loadPhotoForSize to obtain UIImage and than upload it to your server. For example you can use answers from here: ios Upload Image and Text using HTTP POST

UIWebView: How to resize a taken photo (iOS)

Consider my application a webView displaying my website. In my website I have an input tag where to upload a picture. This input tag on a tablet it is great because you can:
upload an existing photo
take an instant photo and upload it
The second option is the one that interests me. The problem is that there is no resizement and the picture sent to the server is 1MB (actual size).
I need that before sending the picture to my server, my application does:
option A: after taken the photo this options are available
option B: automatically the application takes a small photo (already resized)
option C: do you have any other ideas?
Is it possible to do something to resolve this problem? I am developing using SWIFT language.
Thank you

How to open album list like photos native application?

As i saw this in "Viber" application. There is media sharing button which opens all the albums as shown in photos native application. Can we do this ? I found UIImagePickerController cannot shows both simultaneously. How show both photo gallery and video gallery simultaneously ?
You're right about UIImagePickerController here great guide, and github project for picking media.
If you want to share your media here's some cool examples:
Check this tutorial on how to share pictures via email.
If you want to share via mail -
First of all you have to Create NSData object from your PNG/JPEG image data and then implement the method: Send addAttachmentData:mimeType:filename: to your MFMailComposeViewController instance.
Also i think the best thing to use in your case to share stuff like text, pictures etc is Sharekit.

iOS tweet image - Can I get the image url before upload?

I want to be able to share images from my app on twitter/facebook/email etc..
There's probably hundreds of different ways to do this which is quite simple.
However what I need/want to do, is allow the images to be opened by other people straight into my app (If they have it installed).
So I have a url scheme so a url will open my app with an image like this:
myurlscheme://image?url=http://imageurl.com
The problem I have, is the process for uploading the image, but adding my url scheme to the beginning of the url.
If I could know the url twitter/facebook is going to use before I send the tweet, I could add my url scheme to the front of the image url and put it in the tweet. I'm guessing this might not be possible though.
Another thought is to upload the image to another service, get the url, then compose and send the tweet. Are there any suitable services for doing this? (Preferably free services) I dont really want to have to host the images myself.
Thanks
1) I don't see how you plan on conjuring an image URL before you upload the image - that is a chicken/egg situation. I would recommend taking a look at an actual image URL after you upload it to facebook, twitter, etc and try to figure out even one character of what it would be for the next image you upload. Regarding twitter specifically the image URL is also going to vary depending on what upload service is being used.
2) regarding uploading the image and getting the URL why not look into tapping into the flickr API?

instagram iphone hooks MEDIA ID?

I want to open instagram with the picture from my app.
In their API
it says to use the MEDIA ID. I am unaware of a media ID. I know of Asset Representation URL form the ALasset library. Does anyone know what they are refering to?
The media ID comes from the Instagram API for the media that was uploaded to instagram. Usually something on the lines like 448979387270691659_45818965. I believe you can grab it in the browser if you go to the media view in your browser and then use developer tools to see the atttribute

Resources