I'm currently adding some photo-taking functionality to my application.
I'm curious about something, though. After the photo is taken, this code holds it as a piece of data:
NSData *imageData = UIImagePNGRepresentation(saveImage);
What I need to know is how the picture, after taken by the user, would get sent to the web via a PHP script. The script has been written, but on the iPhone end, what would I have to do programatically to ensure it gets sent to the database in the right format for viewing? I have the "POST" NSURL request setup, which I've used many times for posting strings/numbers, but I don't know if this is different for photo data.
Open Google, search for 'cocoa upload photo iphone', see first result:
How can I upload a photo to a server with the iPhone?
Related
I'm trying to upload a video using the API. I can successfully authenticate, upload and create a video and receive a video id. But when I query the processing status using https://api.dailymotion.com/video/{VideoId}?fields=status%2Ctitle%2Cpublishing_progress URL, it keeps returning "publishing_progress": 7 no matter how long I wait.
If I try to upload the same video using the website directly it will process it just fine.
I wonder if anyone else has encountered this issue and know how to solve it.
I think there is an issue with the source URL you associated to the video.
Have you correctly filled the URL field at the video creation (STEP 4.) with the URL returned by the API when you uploaded your video (on STEP 3.)?
If so, you would encourage you to contact our support with more details to dig further into possible issues
My app is an image viewer for iOS. I allow users to pick files from the camera roll or cloud file providers. For each file chosen, I create a bookmark so that the user to come back to view the file later without having to go through all of the steps of the camera roll/cloud file pickers again. The camera roll bookmarks work consistently, but the cloud file provider bookmarks fail randomly by returning nil from the call to URLByResolvingBookmarkData. The error returned is:
"File Not Found"
This happens with files from iCloud, DropBox, Box, Google Drive, etc. Here is how I create and retrieve the bookmarks:
// bookmark created from url returned by UIDocumentPickerViewController
NSData *bookmark = [url bookmarkDataWithOptions:options includingResourceValuesForKeys:nil relativeToURL:url error: nil];
// retrieving the URL from this bookmark works for a short time, then returns nil
url = [NSURL URLByResolvingBookmarkData:bookmark options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:&isStale error:&error];
Anyone can shed some light as to why a bookmark will work for a while, then fail? Limited storage/RAM?
I have a feeling that the answer is to keep a local copy of files from cloud storage since they're not guaranteed to be accessible more than once.
You should use startAccessingSecurityScopedResource on the URL, making sure to call stopAccessingSecurityScopedResource when you are finished.
Alternatively, Apple highly recommend using FileCoordinator or UIDocument to manage access to files. Especially now you may access files that other apps are also accessing.
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
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?
I'm writing an iOS app that produces an image, and we'd like the user to be able to post that image to their Facebook wall using the standard facebook dialog.
The Facebook iOS SDK provides a dialog for posting to a user's wall, using the dialog:withParams:andDelegate: method, and you can provide the URL of a picture in the params argument. However, that's no good to me - I want to send off an image that exists only on the phone.
The SDK also provides a way to post an image to a user's wall, using the requestWithGraphPath:andParams:andHttpMethod:andDelegate: method. But that's no good to me either - I want to use the standard dialog.
Is there a way for me to send the image data with an FBDialog?
You need to do a photo upload first, with a graph call to '/me/photos' - this will be in an album that your app will have to create, not an existing one (unless your app created it).
That will return you the photo id, which you can then hit the graph again with a call to that specific id: 'https://graph.facebook.com/RETURNING_PHOTO)ID'
This will return name, picture, source, link (and a bunch of other stuff) - you can then use the picture (which is a thumbnail) in your wall post as the picture and add the URL to the source (big image) or use the link to the photo in the album (link) inside your message text.
Hope this helps,
-J