Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何显示从phonegap捕获摄像头拍摄的图像日期_Javascript_Php_Android_Cordova - Fatal编程技术网

Javascript 如何显示从phonegap捕获摄像头拍摄的图像日期

Javascript 如何显示从phonegap捕获摄像头拍摄的图像日期,javascript,php,android,cordova,Javascript,Php,Android,Cordova,我使用PHP开发web应用程序,在这个应用程序中有显示拍摄日期的功能,从上传到我的服务器的手册(通过web)图像中的设备名称成功显示拍摄日期和设备名称。然后,我使用phonegap创建了移动应用程序(android),并提供了捕获图像和保存到我的应用程序目录的功能。当用户将数据保存到服务器时,我将从phonegap摄像头功能捕获的照片上传到服务器。但当我在我的网络应用程序中显示日期:不可用?并且设备名称可用 我的javascript代码 function capturePhotoBatasAta

我使用PHP开发web应用程序,在这个应用程序中有显示拍摄日期的功能,从上传到我的服务器的手册(通过web)图像中的设备名称成功显示拍摄日期和设备名称。然后,我使用phonegap创建了移动应用程序(android),并提供了捕获图像和保存到我的应用程序目录的功能。当用户将数据保存到服务器时,我将从phonegap摄像头功能捕获的照片上传到服务器。但当我在我的网络应用程序中显示日期:不可用?并且设备名称可用

我的javascript代码

function capturePhotoBatasAtas() {
    // Take picture using device camera and retrieve image as base64-encoded string
    navigator.camera.getPicture(onPhotoDataSuccessBatasAtas, onFail, { quality: 100,
    destinationType: destinationType1.FILE_URI });
}

function onPhotoDataSuccessBatasAtas(imageData) {
     ImagedataBatasatas = imageData;
     var smallImage1 = document.getElementById('BatasAtasPreview');
     smallImage1.style.display = 'block';
     smallImage1.src = imageData;
}

// save temp in array for many photo preview
var BatasAtasInfo={
        Keterangan:$('#txtKeteranganFotoBatasAtas').val(),
        val:ImagedataBatasatas
}

// save photo in my app folder before upload to server periodicly

for(var i=0;i<BatasAtasPhoto.length;i++){
        var object = BatasAtasPhoto[i]
        movePic(object.val,id+"BatasAtasPhoto"+i,function(entryData){
            if(entryData.isFile){
                BatasAtasPhoto[i].val = entryData.fullPath;
            }
        });
    }


function movePic(file,fileName,myCallBackUrl){
window.resolveLocalFileSystemURI(file, function(entry){
    //Callback function when the file system uri has been resolved
    var d = new Date();

    //new file name
    var newFileName = fileName + ".jpg";
    var myFolderApp = "sidato_app";
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) {
            //The folder is created if doesn't exist
            fileSys.root.getDirectory( myFolderApp,
                {create:true, exclusive: false},
                function(directory) {
                    entry.moveTo(directory, newFileName,  function(entry){
                        //Callback function when the file has been moved successfully - inserting the complete path
                        myCallBackUrl(entry)
                    }, resOnError);
                },
                resOnError);
        },
        resOnError);
}, resOnError);
}
日期在哪里

使用phonegap拍摄照片时是否有日期问题


感谢您的帮助…

服务器(php)或phonegap(javascript)中的代码?两者都有,很可能javascript部分会等待,因为我要去办公室,在这之后,我在这里写这两个。我一直在用代码编辑我的问题,希望能让任何人更容易地帮助我。。
$path="../Model/photo/".$row['photo'];
$camera = cameraUsed($path);
echo '<div class="active item">';
if($_GET['act']==1){
    echo '<input type="button" class="btn btn-danger" value="Delete"   onclick=hapusFoto("'.$row['photoclimbupPK'].'") />';
}
echo '<img src="../Model/photo/'.$row['photo'].'"  />';
echo '<div class="carousel-caption">
<h4>Keterangan</h4>';
echo        '<p>';
echo "Camera Used: " . $camera['make'] . " " . $camera['model'] . "<br />";
echo "Date Taken: " . $camera['date'] . "<br />";
echo $row['Keterangan'].'</p></div></div>';
function cameraUsed($imagePath) {

// Check if the variable is set and if the file itself exists before continuing
if ((isset($imagePath)) and (file_exists($imagePath))) {

  // There are 2 arrays which contains the information we are after, so it's easier to state them both
  $exif_ifd0 = read_exif_data($imagePath ,'IFD0' ,0);       
  $exif_exif = read_exif_data($imagePath ,'EXIF' ,0);

  //error control
  $notFound = "Unavailable";

  // Make 
  if (@array_key_exists('Make', $exif_ifd0)) {
    $camMake = $exif_ifd0['Make'];
  } else { $camMake = $notFound; }

  // Model
  if (@array_key_exists('Model', $exif_ifd0)) {
    $camModel = $exif_ifd0['Model'];
  } else { $camModel = $notFound; }

  // Exposure
  if (@array_key_exists('ExposureTime', $exif_ifd0)) {
    $camExposure = $exif_ifd0['ExposureTime'];
  } else { $camExposure = $notFound; }

  // Aperture
  if (@array_key_exists('ApertureFNumber', $exif_ifd0['COMPUTED'])) {
    $camAperture = $exif_ifd0['COMPUTED']['ApertureFNumber'];
  } else { $camAperture = $notFound; }



  // Date
  if (@array_key_exists('DateTime', $exif_ifd0)) {
    $camDate = $exif_ifd0['DateTime'];
  } else { $camDate = $notFound; }

  // ISO
  if (@array_key_exists('ISOSpeedRatings',$exif_exif)) {
    $camIso = $exif_exif['ISOSpeedRatings'];
  } else { $camIso = $notFound; }

  $return = array();
  $return['make'] = $camMake;
  $return['model'] = $camModel;
  $return['exposure'] = $camExposure;
  $return['aperture'] = $camAperture;
  $return['date'] = $camDate;
  $return['iso'] = $camIso;
  return $return;

} else {
  return false; 
} 
}