Open swissdude opened 3 years ago
CameraPlus
Set
saveToGallery
tofalse
.When photoCapturedEvent is emitted, the event.data contains not a saved image, but just an empty object.
Cause:
in
index.ios.js
Line 490 ffMySwifty.prototype.savePhoto
var asset_1 = new ImageAsset(this._photoToSave);
fails.
this._photoToSave
is an iOSUIImage
and it seems ImageAsset can't handle this.Solution
Safe the image and then return it.
So I added this to the function:
if (isIOS) { const imageFolder = knownFolders.documents(); const iosImage = UIImageJPEGRepresentation(this._photoToSave, 0.7); const result1 = NSFileManager.defaultManager.createFileAtPathContentsAttributes(imageFolder.path + "/cam_capture.jpg", iosImage, null); const asset = new ImageAsset(imageFolder.path + "/cam_capture.jpg"); _this._owner.get().sendEvent(CameraPlus.photoCapturedEvent, asset); _this.resetPreview(); }
Of course, you can give the image a different name and save it at a different location.
Can you show me how you left your code? I tried to add and it didn't work.
Did you also manage to decide on the selection of photos from the gallery? same problem occurs
CameraPlus
Set
saveToGallery
tofalse
.When photoCapturedEvent is emitted, the event.data contains not a saved image, but just an empty object.
Cause:
in
index.ios.js
Line 490 ffMySwifty.prototype.savePhoto
var asset_1 = new ImageAsset(this._photoToSave);
fails.
this._photoToSave
is an iOSUIImage
and it seems ImageAsset can't handle this.Solution
Safe the image and then return it.
So I added this to the function:
Of course, you can give the image a different name and save it at a different location.