放入从相机或自己的相机拍摄的帧图像

put in a frame image taken from the camera or on own camera

我正在学习,我正在尝试开发我心目中的应用程序。

但是,我正在尝试为拍摄的照片甚至在触发相机时放置背景图像或框架。

我正在使用 angular 和离子框架为 android 开发。

不知道可不可以,谢谢! O/

简单!

function takePicture() {
  navigator.camera.getPicture(function(imageURI) {

    // imageURI is the URL of the image that we can use for
    // an <img> element or backgroundImage.

  }, function(err) {

    // Ruh-roh, something bad happened

  }, cameraOptions);
}

阅读更多:http://learn.ionicframework.com/formulas/cordova-camera/

是的,它是 possible.Apply 捕获后 image 标签的一些 css 规则。

1.Capture 图片

首先使用命令

添加Camera插件
cordova plugin add org.apache.cordova.camera

HTML

<button ng-click="takePhoto()">Capture</button>
<li ng-repeat="i in myImage">
    <img ng-src="{{baseURL+i}}">
</li>

控制器

$scope.takePhoto = function() {
    navigator.camera.getPicture(onSuccess, onFail, {
        quality: 75,
        targetWidth: 320,
        targetHeight: 320,
        destinationType: 0,
        saveToPhotoAlbum: true
    });

    function onSuccess(imageData) {
        $scope.imgURI = imageData;
        $scope.myImage.push($scope.imgURI);
        $scope.$apply();

    }

    function onFail(message) {
        alert('Failed because: ' + message);
    }

};

Refer

2.Save 拍摄后的照片

如果您想在 storage.Please 中保存这张照片,请同时添加 file 插件,

cordova plugin add org.apache.cordova.file

控制器

$scope.takePhoto = function() {
    if (window.cordova) {
        var options = {
            quality: 100,
            destinationType: Camera.DestinationType.FILE_URI,
            sourceType: Camera.PictureSourceType.CAMERA,
            encodingType: Camera.EncodingType.JPEG,
            cameraDirection: 1,
            saveToPhotoAlbum: true
        };
        $cordovaCamera.getPicture(options).then(function(imagePath) {
            $scope.imgURI = imagePath;
            //Grab the file name of the photo in the temporary directory
            var currentName = imagePath.replace(/^.*[\\/]/, '');
            //Create a new name for the photo
            var d = new Date(),
                n = d.getTime(),
                newFileName = n + ".jpg";
            //Move the file to permanent storage
            $cordovaFile.moveFile(cordova.file.tempDirectory, currentName, cordova.file.dataDirectory, newFileName).then(function(success) {
                //success.nativeURL will contain the path to the photo in permanent storage, do whatever you wish with it, e.g:
                //createPhoto(success.nativeURL);

            }, function(error) {
                //an error occured
            });

        }, function(error) {
            //An error occured
        });
    }
};