Closed chiraganand closed 11 months ago
@chiraganand have you done this
- in Xcode, open `Info.plist` and add a new Information Property like `Privacy - Photo Library Usage Description` and set a value to `We need to write photos`. This is required to have the `Share`of images and the `create Movie` working.
@chiraganand have you done this
- in Xcode, open `Info.plist` and add a new Information Property like `Privacy - Photo Library Usage Description` and set a value to `We need to write photos`. This is required to have the `Share`of images and the `create Movie` working.
Yes, this already exists in Info.plist:
<key>NSPhotoLibraryAddUsageDescription</key>
<string>For saving images</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>For image sharing</string>
Alright, so I debugged it and got it working by modifying OneImageViewController::shareButtonTapped()
:
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.clipsToBounds = true
- imageView.sd_setImage(with: URL(string: url), placeholderImage: nil)
+ let sUrl = url.replacingOccurrences(of: "capacitor://localhost/_capacitor_file_", with: "")
+ imageView.sd_setImage(with: URL(fileURLWithPath: sUrl), placeholderImage: nil)
May not be the best way to fix this because maybe a class member can be created to hold this value, perhaps.
I can create a PR with this if this looks okay.
@chiraganand can you give me the full url so i can have a look
@chiraganand can you give me the full url so i can have a look
Do you mean full URL of the file?
capacitor://localhost/_capacitor_file_/var/mobile/Containers/Data/Application/4FF99DC9-9CCA-4BF3-B3EB-F2E27E3D5A67/Library/NoCloud/download/Img_file.jpg
@chiraganand i test this
this.imageList.push({url: 'capacitor://localhost/_capacitor_file_/var/mobile/Media/DCIM/100APPLE/IMG_0013.JPG', title: 'Image13'});
when i am in gallery i got the image i click on it and i click on the button share and as i am on an emulator i select copy image and when i go to the photo application i can see that the image has been copied and if i ask for info i got IMG_0015
so for me it is working so this is why i was asking you the url of your image
In my case, the image is already stored in the application directory and when I view that is when this issue happens. Perhaps, something to do with the path.
Also, when I try to run my app in a simulator I am not able to even view the photo because the getImage() function requires "mobile" in the path which is not present in the simulator so it shows the placeholder image. I fixed this by replacing "mobile" with "data".
So, I am also guessing this could be something to do with the path.
@chiraganand How did you create the image Img_file.jpg in Library/NoCloud/download
I am downloading the image from a remote server and then saving it using the Cordova File plugin.
@chiraganand i am doing the same except that i do not use the cordova file plugin but some functions that i implement myself in photoviewer so i save the image in 'capacitor://localhost/_capacitorfile/var/mobile/Containers/Data/Application/88CDCA9F-627C-4554-A5BC-BC7A55FA7D93/Library/Images/Download/test_image' and when i pass that url in the imageList i saw the image in the gallery and when i click on it and click on the share button it works like expected
@chiraganand in the release 3.0.4 i have added the feature to load an image from http request and save it internally to the device having load an image go to the slider share the image and it works fine so i cannot reproduce your case
@chiraganand hi, did you try 3.0.4
@chiraganand As you did not come back i assume that it is working. So i close the issue. Feel free to re-open if needed
I am using
capacitor://
protocol. The plugin is able to use this to show an image (single image) but throws when trying to share it.Log: