React Native, storing images in users gallery without compression - ios

I am developing an App that verifies images based on their hash. I hash the images using this library "react-native-fetch-blob".
I store all the images taken inside the app, I am trying to allow users to be able to share the original uncompressed image.
Problem: When using React-Native Camera roll or React native Share to save the image to my local gallery, compression is performed which changes the hash of the image if I recalculate it.
What I want to do, is to be able to save the image to the users local gallery without compressing the photo?
Any help would be very appreciated. :)
I have run tests retrieving the photos back into the app (from the user's normal gallery) using React-Native-Image-Picker; However, I believe that also forms some compression on the image. I have also used react-native-fetch-blob to copy the photo from the user photo gallery back into the app.
Can provide code I used to generate the below results if anyone needs that.
Hash Results - from Image Picker
camera roll save
10c30a42ead3636a8fd8cfd1eb6952db9f8bbb97fbbdccf96060b67f27be0766
fileSize: 591635,
React-Native share save image
cf799ba599e65a42905cb25fabc0150286ee923113da2af21ad7bb2a650bb86d
fileSize: 603288
Expected
Hash0802368f14296c4d6750a4fc853cda68de67b8e31adf16f38b0eabb7e8b28d0a
Thanks Again

Solved issue on react-native-camera-roll. Issue was stripping of meta-data on IOS side.
https://github.com/react-native-community/react-native-cameraroll/issues/125

Related

Images not displaying on other iOS devices

I am having issues displaying images in my FlatList on other iPhones/iOS devices or iOS simulator. I can view the images on my iPhone but they do not show on other devices. I'm aware that the images are locally stored on my phone, and so I believe this may be the reason why I can see the images on my phone and not on others.
On the simulator the error below appears on initial render and the screen appears blank with no images:
Task orphaned for request <NSMutableURLRequest: 0x600...>
I am using react-native-image-crop-picker to get the pictures and and Firebase real-time database to store the images.
How do I view the images on other devices? Can someone please assist? I am fairly new to React Native. Please do let me know if you require more info.
Using react-native-image-crop-picker, you need to save the whole image on your database or on your storage, you can't save tha local path and pretending that other phone will see that image.
You have two possibility, the first one is to use firebase storage. When react-native-image-crop-picker give you the path, you can use that path to upload the image on firebase storage and save the downloadUrl on your document. Then you can use that downloadUrl to show the image on other phone.
The second one is to use the incluseBase64 prop on react-native-image-crop-picker and use that base64 string to show the image and save it to your database.

Capture a image and know the location of that image from where it was captured in iOS

I am going to design a app in iOS in which i have a functionality, whenever i capture a image from an iOS device that "image should not be saved in the camera roll" and "i need to know the exact location from where the image was captured that is street address, country, etc,.....". Any help would be appreciated.
Thanks in advance.
Exif Data is the partially hidden part of a photo file that most people don't think about when they upload a photo to a service like Dropbox or send a photo to a friend. This EXIF data includes the camera model you are using, basic settings of the camera when the picture was taken, the photo resolution and, if your camera has GPS, the location where the photo was taken.
You can extract the Exif data from image file (Get Exif data from UIImage - UIImagePickerController).
You can also view that data with Preview app on mac. To see go to Preview and click for info for image their you get GPS data for file.
It is correct that the iphone(ipad, etc, i'll just call it iphone from now on) strips exif data. This is also not a bug on the iphone but actually a feature.
One of the main reasons android users don't like the iphone and iphone users don't like the androids, is because the iphone is very limited (in terms of freedom to change, alter, etc). You can not just run downloaded apps, have limited access to settings, etc.
This is because the apple strategy is to create a fail-safe product. "If you can not do strange things, strange things will not happen".It tries to protect the user in every way imaginable. It also protects the user when uploading images. In the exif there may be data that can hurt the users privacy. Things like GPS coordinates, but even a timestamp can hurt a user (imagine you uploading a beach picture with a timestamp from a moment you reported in sick with the boss).
So basically it is a safety meassure to strip all exif data. Myself and a lot of other people do not agree with this strategy, but there is nothing we can do about it unfortunately.
The solution
Update: This does not work.
Luckily you can get around this problem. Javascript comes to the rescue. With javascript you can read the exif data and send it with you photo by adding some extra POST data.
please note: this solution was presented to me by another developer and is not yet tested.

Cordova: Access photos in the CameraRoll without using an imagepicker

The Cordova Camera API v3.1.0 gives me access to a single CameraRoll photo through something like the UIImagePicker. But I need to be able to iterate through every photo in the CameraRoll to extract things like timestamp and GPS coordinates.
Will a custom Cordova plugin be able to provide complete access to CameraRoll photos through ALAssetsLibrary (iOS) without requiring me to copy every photo into App storage? (I assume there would be an equivalent native lib for Android.)
Also, if I write a custom plugin, will I also have to create a custom ImagePicker/Thumbnail Gallery to support user interactions? If so, could that be HTML5 or would it also be native?

accessing ios photos and uploading to a webserver

I am trying to build an iOS application that will display all of the iOS device's photos in a view. The user should then be able to click each photo to select (multiple selections allowed) then after selecting, upload the photos to a webserver.
Is it possible to access the photos that are controlled by the Photos application? Does anyone know of any efficient way to get access to the photos (third party framework) and/or a tutorial?
Thanks
Apple's developer site lists the Assets Library Framework as a way "to access the pictures and videos managed by the Photos application." The documentation there is fairly extensive, and looking around the dev site more should yield several tutorials and example apps.
AFAIK you can't grab all images from camera roll and use them in your app but you can have a UIImagePickerController that lets the user choose the image from their camera roll and a delegate is fired when they select one (or take a picture depending on how you set it up) then you can use that image in your app.

How do I ensure that photos uploaded via my iOS app aren't blurry?

I'm working on an iPhone art app in which users can export their work to Facebook via photo upload. The images are 320 x 320 and I'm sending over a PNG, created via the UIImagePNGRepresentation function. Uploading works, but once I view the photos on Facebook, they look bad: very blurry. So, I tried sending a bigger file... still blurry. I tried sending a JPEG instead, via UIImageJPEGRepresentation at the highest quality, but still no luck.
I'm doing the upload via a Graph request to "me/photo", with a POST. The request params are "picture" for the image data and "message" for a caption.
I'm using the same code to export to Twitter and Tumblr and the photos look great there, so I'm not sure what I'm doing wrong or if this is just some kind of limitation of Facebook. I haven't been able to find any recommended file type or size in the API docs.
I've had this problem when I designed stuff for Facebook (e.g. a Page's profile pic), saved it as a beautiful PNG, uploaded it, but once on Facebook it would look very bad.
I have found that Facebook, unlike Twitter and Tumblr, compresses all its images using a very low quality JPG setting, so there is nothing you can do here to stop your pics getting blurry other than waiting and hoping that Facebook increases the JPG quality setting, or allows uploading of alternative formats, but I wouldn't hold my breath.

Resources