android - Ionic Camera Plugin - Can only show Image if Image is Captured or Selected from Select Locations -
for purposes of question, relevant app use has ability 1 of following
- take photo
- select photo
when select photo, want display image on view.
this looks following:
the problem having when test android, take photo
option works consistently, while select photo
method work if chosen same gallery captured images stored.
for example, choosing take photo
- image stored @ following location
file://storage/emulated/0/android/data/path.to.my.app/13124124/cache/segweg.jpeg
and image shows fine.however, if choose select existing photo gallery , choose somewhere other images stored camera capture, path looks following , not work:
content://media/external/images/media/4430
the angular code looks following:
$scope.getphoto = function() { camera.getpicture({ sourcetype:1, //camera destinationtype:1, //file uri savetophotoalbum:false, correctorientation:true }).then(function(imageuri) { $scope.imageuri = imageuri; //always works }, function(err) { alert('an error has occured'); }); }; $scope.selectphoto = function(){ camera.getpicture({ sourcetype:0, //photo album, destinationtype:1, //file uri savetophotoalbum:false, correctorientation:true }).then(function(imageuri) { $scope.imageuri = imageuri; //this works }, function(err) { alert('an error has occured'); }); };
and markup in template looks following:
<ion-view view-title="photo"> <ion-content> <p class="text-center" ng-click="selectphoto()"> <span class="ion-image send-photo" ng-if="imageuri == undefined"></span> <img ng-if="imageuri != undefined" ng-src="{{imageuri}}"></img> </p> <button class="button-red button button-block" ng-click="getphoto()"> take photo </button> <button class="button-red button button-block" ng-click="selectphoto()"> select photo </button> </ion-content> </ion-view>
update
i ran adb logcat *:e
see if turned , saw following error popup.
e/galleryutils(26145): error while using contextprovider e/galleryutils(26145): java.lang.illegalargumentexception: unknown url content://com.samsung.android.providers.context.log.action.report_app_status_survey e/activitythread(26145): failed find provider info com.samsung.android.providers.context.log.action.report_app_status_survey
Comments
Post a Comment