phonegap's camera API has this iphone quirk noted:
When destinationType.FILE_URI is used, photos are saved in the application's temporary directory.
details here
and when I load the photo from album, I get imageURI like this
file://localhost/var/folders/sV/sVG0cyUrFvKs6+6I16IO+U+++TI/-Tmp-/photo_007.jpg
and every time I get a different URI for the same photo. Is it possible to get the URI of the original photo file instead of the temporary copy? I need to have the image URI and display multiple photos on the same screen.
Thanks for your help.
Actually it is not possible on iOS as the photos are stored in an area that is not accessible via URL. We need to copy the image to the application specific temp directory so it will be readable by your app.
Related
So I have a image which I get from my server. I want to save that image locally. I have already considered using Userdefaults or Core Data for this instead, but I want the user to be able to see and view the photos from their photos app. So I have a saved photo which is saved using UIImageWriteToSavedPhotosAlbum. How do I later retrieve that same image in my app? This includes even after the app is closed and relaunched.
Are you using the PHPhotoLibrary framework? If so, you can use PHFetchOptions to fetch the photos that were saved by your application. Enter parameters such as album name to retrieve the photos you have saved.
If you have the url of the image being stored using UIImageWriteToSavedPhotosAlbum then use that url to retrieve that image using FileManager API.
Get image from documents directory swift
I have a macOS Photos extension where I update the metadata for the photo. The metadata (location information) is saved correctly, but the Photos application does not recognise the changes since it seems like it is storing its own location information about the photos separately from the photo itself. If I manually export the photo from Photos and re-import it, the location is properly shown in Photos.
Is there a way (in Swift) to trigger a reload of the metadata or to re-import the photo into Photos?
When using the Facebook Graph API and including a Picture with a post, the picture always appears as a small thumbnail. Is there a way to make the picture larger like it appears when you upload a photo and share it?
No, the size of that photo is controlled by facebook and the only thing you can do is playing around with the relative size of the photo you use so that it would look slightly bigger (you should use pictures with landscape layout as opposed to portrait to get a 'slightly' bigger photo.
The hack you can use to do that is what apps like Instagram and Path did: Each time someone uploads a photo, they upload the photo to an album named "Instagram/Path photos" and include the link to the original photo in the caption (in your case,the link to the original article).
However, in order to do that, you users must grant you additional permissions on Facebook and they may not like the idea of uploading photos to another album, so I (personally) wouldn't go that way.
So what I am trying to do is post an image that has been created by a user on an iphone into that users newsfeed.
The functionality I am having a hard time understanding if it is possible:
Can I pass a local NSURL (or URL?)(to a png file that lives in the documents folder) through a JSON string and onto Facebook?
i want to mimic the action of a user going to his/her facebook page, clicking into the textfield for their newsfeeld, uploading an image by clicking the "photos" icon and selecting an image from a local disk and uploading it. I would also like to add some text into the post optionally.
I'm just getting started with the Facebook api and it seems pretty tough right now, any help would be appreciated. code examples appreciated.
Thanks,
Nick
You'll need to use a third-party image host like YFrog or roll your own image host. Facebook requires that all media attachments (including photos) be hosted on the public web. Even though they cache the images themselves, the URL that you send to them has to have its own public URL. Many of the popular Twitter image hosts have simple REST APIs to achieve this.
You can also use Facebook itself to host the image via their photo.upload API, if you don't mind two side-effects: it will appear in the user's photo albums, and the thumbnail is likely to appear in the stream twice (once representing the addition to the photo album, and the second in the actual stream story you publish). You can't currently get around this doubling artifact, but it will give you a stable host for the uploaded image.
Just to clarify this. I was actually able to pass and image directly from the iPhone without a third party but that was posting an image to a users photo album. There are I think two methods in the fbconnect api for posting one contains an extra argument for a data argument which can be an image. I'll post more details when I'm in front of the documentation.
I am trying to count total photos on the iphone and get the total filesize. What is the best way?
At least in 2.x SDKs, you can't access actual photo files programmatically from code. However, you can access thumbnails of photos which you can use to get a count of photos.
Original photo themselves are in a special database file (/private/var/mobile/Media/Photos/Photo Database) and thumbnail pictures are in a directory (/private/var/mobile/Media/Photos/Thumbs).
Photos can be accessed only through interactive UIImagePickerController. Reverse engineering Photo Database file format is the only way I can see that would give you an access to original photo files programmatically.
I haven't checked the situation for 3.0 SDK, it might give you some API to access photos programmatically.