save profile image inside app using the built in camera - swift

I have an app that contains a profile of the user.
In the profile editing, he has an option to take a photo of himself, then that photo should be saved in his details and be presented in certain places in the app.
Is there a way to internally save an image (not in his phone's photo gallery, but inside the app itself, so he cannot delete the photo through the phone), and then fetch that image every time I need it?
I understand I cannot use CoreData to save images, so I am wondering if there is an easier way to get it done efficiently.
Or must I do that in a server?

not in his phone's photo gallery, but inside the app itself
You can't store anything at runtime "inside the app itself". But the app has a sandbox, a folder area belonging to you alone, where you can store any file you like — in the Documents folder or the Application Support folder, for example. So why not just use that?

Related

Phonegap App lost images on update, recovering from the camera roll

I have an app where users take images and they are saved along with user notes. Per the following link this is what I was using to save the images to the app. The issues is when some users update the app the images are lost.
Phonegap - Retrieve photo from Camera Roll via path
per the bosses instructions the users aren't allowed to browse the gallery for images as they are being used as proof of work performed (small company, 5-12 employees using the app).
is there any way for iphone to relay back to the app the actuall image location on the camera roll like android does? Then I can just save the URI to the database and call it when the form is submitted...
Thanks
You need to use
window.resolveLocalFileSystemURI()
to convert the filelocation to a fileentry or else your filepath will contain the App UUID which changes when you update/deploy your app.

Change background image periodically from website in Phonegap Iphone app

I'm new to iPhone development and making an app using PhoneGap framework .
In home screen I have used grid with iPhone style icons to make it like sprigboard layout and there is an background image to this homescreen body tag.
What I want to do is this background image should change periodically (once a week or once a month), after the time interval the app should fetch new image from website may be from the same url, and store in local storage somewhere, so until the next interval the app should show this image as homescreen background. I can use JSON to fetch image.
I don't want to use any native IOS features.
How can I do that using PhoneGap?
You would want to store the image using the local file storage system. Check out
http://docs.phonegap.com/en/2.6.0/cordova_file_file.md.html#FileTransfer
You can download the file and store the file name in Localstorage -
Write a javascript function that checks if the name of the file is stored, if so then set the background image using Jquery or the like.
Maybe have a look at this
http://www.raymondcamden.com/index.cfm/2012/1/19/Downloading-files-to-a-PhoneGap-application--Part-1
I ended up saving a dummy file first so I could get the full path to the URL of the folder the file will be stored in (different from each install of the application)

How to save a large (60mb+) image to photo library?

I know the various ways to save a UIImage to the photo library:
UIImageWriteToSavedPhotosAlbum
ALAssetsLibrary
However, my images are HUGE (60mb+), so bringing them into memory is not possible. I can download the images by streaming them to disk, and even use imageWithContentsOfFile to take a peek (although that is kind of unnecessary given screen size).
But I want the user to be able to save these images for later. Is there anyway for me to get these large images into the photo library? Do I just have to keep them stored locally inside the app sandbox?
I believe that there is no point at storing them at the photo library, since it is designed to be viewed on the device and theres no point at viewing an image so big. If you want to let the user see the image then i suggest you create a preview and save THAT version into the photo library. If you want to let the user transfer them from the device to the computer there is a special folder in your app bundle which will allow those pictures to appear when using itunes and selecting your application. then he can transfer those pictures to his computer. Also could you elaborate on the characteristics of the images? format, dimentions, purpose, etc.

Creating an app that accesses all images in user's Photos for iOS?

I haven't found any documentation on this or seen this done before, but is there anyway I can, instead of just choosing one image with UIImagePicker, load the user's albums, and then after selecting an image, that image displays, but also allows me to scroll left and ride to see all the images before and after that image?
I know I can use a multiple image picker, but that involves importing all the user's photos, and if the user has hundreds of photos, this would take a lot of time. I'm looking for similar functionality to the real photos app- the performance and everything. Any ideas?
Yes, you can. Look at the documentation for ALAssetsLibrary. This will allow you to enumerate all the user's image (and video) libraries. From this, you get ALAssets, which you can ask for their default ALAssetRepresentation. This one, in turn, you ask for its CGImage, from which you can create a UIImage.
Enumerating Libraries and Assets is done in blocks, which can easily be done in the background.
Use the assets library: http://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html
An instance of ALAssetsLibrary provides access to the videos and
photos that are under the control of the Photos application.
The library includes those that are in the Saved Photos album, those
coming from iTunes, and those that were directly imported into the
device. You use it to retrieve the list of all asset groups and to
save images and videos into the Saved Photos album.
note: only available in ios 4+

Importing photos saved in ios device's Documents folder to desktop

I'm creating a catalog/collection ios4 application. One element of the app lets the user take a picture which they use for a new item entry. The image they choose is then saved to their app's local Document folder.
I was wondering if it's possible to give the user the ability to import the photos to their desktop when they plug in their ios device. Like how iPhoto lets you import photos from your camera roll when you plug in your device
I've looked around, and all i can seem to find are posts on saving to the documents folder, and then retrieving the data within the app.
Any help would be great.
Thanks Ian
You could use an intermediate web service to transfer the files. Upload them to your service from the device, download them to the desktop.
Apple locks this stuff down pretty tight, so that might be your best bet.