我使用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);
}
然后有My Php代码用于显示日期和设备名称
$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>';
函数camerea在php中使用
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;
}
}
日期在哪里?
捕获照片使用phonegap日期的任何问题?
感谢您的帮助......