Linking to selected photos - iphone

If I allows users to select photos and need to store those selections (in a database), can I store a link to the selected photo or do I need to grab the image and store it in the app's Documents folder? The latter doesn't seem practical since it will cause the image to neednessly take up double the amount of space.
I'm familiar with UIImagePickerControllerDelegate but not sure how to obtain a reliable reference to an image that sustains across application restarts. There is probably the concern that the link can break if the user deletes that image from their photo library. Is there a way to check that?

There is no way to get a file url to an image stored in the Photo Library.
If you really do need to keep a reference to the file for programatic reasons, then choosing the image from UIImagePickerController and saving a copy to the Documents folder is probably your only option.
It would help if we could understand why you require a file reference to the image. As far as the iPhone is concerned, the image is safe and sound in the photo library, if user needs it, it can be picked from the image picker, like normal.
However, if you're trying to use it for a customisable background or something, then I think saving a copy is your only option.

Related

MAUI CollectionView show Thumbnail instead full size photo

I created a Collection View for a app that showing photo specific by self app captured.
When showing the original photo it very slow e.g. the size of 5MB~10MB may be too large for showing.
Is there any way that I can get or even create the thumbnail for preview?
I tried for using C# standard way but the Image.Save( MemoryStream in MAUI is Windows platform only ...
First of all, I want to point out, that it is not a matter of choice.
Too big images will not be rendered, and you will see nothing but white space. (Learned that from testing it on Android.)
You can check this first:
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/graphics/images?view=net-maui-7.0
I also use ImageSharp. (Despite the non-sense that happened recently, this is still a very good tool).
In any case, maybe it will be good to store the photo and the thumbnail separately, speaking of collection view, I do not think that it will perform well, if you need to mass-scale 5-10 MB photos. At least the devices I use cannot do this effectively.

Memory problems when working with images and camera on iphone

In my application users can add up to 8 images taken by the camera and upload them to the server one-by-one.
My problem is that even when taking the first picture i get an memory warning, which of course forces the app to release any view not visible.
What is the best practice approach to handling pictures?
How do I hold them until they're uploaded, without running out of memory?
My objective is to avoid any memory warnings.
Thanks in advance.
/Esben
After clicking images store images into Document directory. It is most safe option to store
images and then use it. Find some tutorial and after click image send image to document
directory and then fetch from directory and use it. Hope it helps you.
Proceed Following steps.
I am faced like this problem, now it's working for me use following steps.
Select image and and display to UIImageView. then Upload to server.
Release UIImageView.
Again take picture and upload to server.

How does One place an image inside of an image using metadata?

For example, I can convert the second image into NSData and then place it inside metadata inside the first image and then when I open the first image and read the metadata I can get the NSData and turn it into an UIImage.
How would I go about doing this? All the metadata tags I see are not large enough to support another picture. I know picture in picture is quite common on desktop apps so I'm interested in getting it to work on the iPhone.
Is metadata the correct way to do this or is there another way?

iPhone: Can I get an image picker to have the documents folder as its source

It looks like I cant create an album for my picture producing app in the photo library... so what I was going to do is save the images to the documents folder for my app, which I think should be easy enough. The issue though is that the image picker seems to only allow you to pick saved images or photo library as the source, and I would like users to be able to view all images created by my app. Is there a way to make the picker work or will I have to roll my own?
the image picker that apple provides only gives you access to pictures saved in the camera roll. It also gives you the functionality to take a new picture if you are on an iphone. If you save pictures in your app's local storage directory, then you need to build your own mechanism for viewing these photos. You may want to take a look at Joe Hewitt's 320 project - it has a lot of good controls that you may find useful.

How do I prompt a user to select an image on the iPhone?

I would like to allow the user to select one of several pre-supplied images. Is there a standard way to do this?
The only thing similar to this that is Standard would be the Image Picker control.
However for this to work you would have to add your images to the iPhone's image library and the user would have to pick them from out of all their other pictures.
What you need to do is build something similar.
You can go as easy or complex as you need/want.
I would go simple (as that is the idea of the iPhone) and have a scroll view (depending on the number of pictures you want) and load thumbnails of the images. When they select one, you do something with it. (Look at the view when you are looking in a photo album on the iphone)
I believe I have seen open-source representations of this before.
I would check google code.
I use a UITableView for this, with a thumbnail and description of the image they're choosing.