nativescript-imagepicker
nativescript-imagepicker copied to clipboard
[Image Picker] Images in iPhone Library not visible
Which platform(s) does your issue occur on?
- iOS
- iOS 15.5
- device, iPhone
Please, provide the following version numbers that your issue occurs with:
- CLI: 8.2.3
- Package Dependencies "dependencies": { "@master.technology/websockets": "^2.0.4", "@nativescript-community/drawingpad": "^4.1.0", "@nativescript-community/ui-material-bottomsheet": "^7.0.4", "@nativescript/background-http": "^6.0.0", "@nativescript/camera": "^5.0.12", "@nativescript/core": "~8.2.0", "@nativescript/imagepicker": "^1.0.6", "@nativescript/secure-storage": "^3.0.0", "@nativescript/theme": "~3.0.2", "@nstudio/nativescript-barcodescanner": "^5.0.1", "@nstudio/nativescript-checkbox": "^2.0.5", "axios": "^0.27.2", "date-fns": "^2.28.0", "nativescript-drop-down": "^6.0.2", "nativescript-feedback": "^2.0.0", "nativescript-iqkeyboardmanager": "^1.5.1", "nativescript-ui-sidedrawer": "^10.0.2", "nativescript-vue": "~2.9.0", "vuex": "^3.6.2" }, "devDependencies": { "@nativescript/android": "8.2.2", "@nativescript/ios": "8.2.3", "@nativescript/webpack": "~5.0.6", "nativescript-vue-template-compiler": "~2.9.0" }
Please, tell us how to recreate the issue in as much detail as possible.
The image picker works, you tap on the button, it asks for permission to access the device's library and then opens the library. but the images in the library are all empty although there are images on the device.
Screen shot:
Is there any code involved?
uploadPicture (inputIndex) {
const input = this.detail.steps[inputIndex]
let context = imagepicker.create({
mode: 'multiple'
})
context.authorize()
.then(function () {
return context.present()
})
.then((selection) => {
selection.forEach(selected => {
console.log(selected)
ImageSource.fromAsset(selected).then((imageSource) => {
console.log('************ Image Source ***************', imageSource)
const folder = knownFolders.documents().path
const fileName = this.makeId() + '.jpeg'
console.log(fileName)
const joinedPath = path.join(folder, fileName)
const image = imageSource.resize(1080)
const saved = image.saveToFile(joinedPath, 'jpeg')
console.log('************ Image saved state ***************', saved)
if (saved) {
console.log('Image saved successfully!')
const file = File.fromPath(joinedPath)
input.field.images = input.field.images.filter((image) => !image.brsk_id)
input.field.images.push(
{
url: file.path,
thumbnail_url: selected
}
)
console.log(input.field.images)
console.log('************** File *******************', file)
} else {
console.log('Error saving image')
}
}).catch((error) => {
console.log(error)
})
})
}).catch(function (e) {
console.log('error in selectPicture', e)
})
},