I'm getting a list of ALAsset items (images and videos) from a specific photo album and trying to view them using a QLPreviewController.
Unfortunately because ALAsset doesn't provide a real file url, just the "assets-library://" type url, viewing them in a QLPreviewController using just that url isn't possible.
My only solution was to first copy each of those ALAssets into the Documents folder inside my app (getting the raw data from an ALAssetRepresentation and saving it in a file), and viewing those with the QLPreviewController, but it ends up being too slow and sluggish when the number or size of files gets bigger.
Is there any way to get this done? Is there any other way to enumerate through the items inside a photo album that would return a true filesystem URL? Or should I just try to make my own preview controller with UIImageViews and MPMovieControllers and recreate all the functionality (swipe, share, etc)?
Related
Hey just wondering if its possible to Select a specific image from the photolibrary and implement into a Collection View
so the idea is to have an image the user can select from the photolibrary then fill the selected image into a cell within the collection view i would also like to be able to save the image so if the user deletes the photo from the library it remains within the application ( was thinking i could save the image within firebase or NSUserdefaults?
A controller demonstrating how to select photos to display in a collection view can be found here.
If you're only going to be saving a single image, then putting it at a known path like demonstrated here would work: How to save a remote image with Swift?
If you're trying to manage multiple images, it's probably a good idea to look into Core Data and have it manage the images' UIImageJPEGRepresentation NSData for you. (Be sure to set "Store in External Record File" for the image data record if you do this!)
My app takes some videos and pictures and stores them in the Application Home/Documents folder. I want to create a gallery that will open and display (and playback) these items. I looked into MPMediaPickerController and it looks like the only option for data source there is the Photos Album.
It looks like I will have to go with creating UICollectionView. Is this the right way to do this or is there another way similar to MPMediaPickerController but with setting the source to an array of data objects?
The best way to do it is use your own implementation UICollectionView. MPMediaPickerController mainly works for media related(especially for songs and videos)
Since you have images and videos just use NSFilemanager to get the files in Documents Directory and pass the information to UICollectionView datasource and handle the touch actions on the UICollectionView didSelect methods.
I am working on a chat application. In that, I have implemented picture uploading and downloading using NMSSH library. Now I am saving the downloaded and uploaded image in app documents file also (saving in iphone gallery too), so that I can display the image after tableview reloading. Is saving images in documents folder is a good method? Is documents folder have any size limit? Is there any way to get the path for the image in gallery?
I'm looking for a custom control I can put in a UIViewController that has the functionality of UIImagePicker (displaying thumbnails, enable multiselect etc.) but display images from "the server" (a given array of images)
All the ImagePickers I find work directly on the albums as an alternative to UIImagePicker
Does anyone know a nice solution?
You can use this lib called "JPImagePickerController"
https://github.com/jeena/JPImagePickerController
You will make your own DataSource which will take your images which could be provided from disk or bundle
Is there a way to remove an image from a custom photo album?
I don't want to permanently delete the asset from the phone but just simply disassociate x image from x album.
I am trying to build an application that automatically manages certain photo albums.
In some cases images would need to be removed from photo albums and added to others.
I am currently using the ALAssetsLibrary to create photo albums and add images to them.
There is no public API to remove an image from a custom/user created album. If you want that feature in the future, request it at https://feedbackassistant.apple.com/.