iphone - exif when uploading pictures with php on a mobile device stripping GPS header? -
i have script upload photos website written in php. when upload picture using safari on iphone, of header appears stripped when check exif data. when take exact same picture iphone , email myself , upload computer, of exif data there.
i wondering if there setting on iphone or php script missing let me grab gps part of exif when try upload iphone. want grab gps array exif_read_data when upload pictures website through iphone.
an exif example safari on iphone:
image type is: jpeg file.filename: 20130417141031image.jpg file.filedatetime: 1366225831 file.filesize: 1692449 file.filetype: 2 file.mimetype: image/jpeg file.sectionsfound: any_tag, ifd0, exif computed.html: width="3264" height="2448" computed.height: 2448 computed.width: 3264 computed.iscolor: 1 computed.byteordermotorola: 1 ifd0.orientation: 6 ifd0.exif_ifd_pointer: 38 exif.colorspace: 1 exif.exifimagewidth: 3264 exif.exifimagelength: 2448
an exif example of same image uploaded pc taken same phone:
image type is: jpeg file.filename: 20130417142504image.jpeg file.filedatetime: 1366226835 file.filesize: 1744896 file.filetype: 2 file.mimetype: image/jpeg file.sectionsfound: any_tag, ifd0, thumbnail, exif, gps computed.html: width="3264" height="2448" computed.height: 2448 computed.width: 3264 computed.iscolor: 1 computed.byteordermotorola: 1 computed.aperturefnumber: f/2.4 computed.thumbnail.filetype: 2 computed.thumbnail.mimetype: image/jpeg ifd0.make: apple ifd0.model: iphone 4s ifd0.orientation: 6 ifd0.xresolution: 72/1 ifd0.yresolution: 72/1 ifd0.resolutionunit: 2 ifd0.software: 6.1.3 ifd0.datetime: 2013:04:17 15:13:39 ifd0.ycbcrpositioning: 1 ifd0.exif_ifd_pointer: 204 ifd0.gps_ifd_pointer: 594 thumbnail.compression: 6 thumbnail.xresolution: 72/1 thumbnail.yresolution: 72/1 thumbnail.resolutionunit: 2 thumbnail.jpeginterchangeformat: 890 thumbnail.jpeginterchangeformatlength: 7684 exif.exposuretime: 1/20 exif.fnumber: 12/5 exif.exposureprogram: 2 exif.isospeedratings: 50 exif.exifversion: 0221 exif.datetimeoriginal: 2013:04:17 15:13:39 exif.datetimedigitized: 2013:04:17 15:13:39 exif.componentsconfiguration: exif.shutterspeedvalue: 2779/643 exif.aperturevalue: 4845/1918 exif.brightnessvalue: 13523/4727 exif.meteringmode: 3 exif.flash: 16 exif.focallength: 107/25 exif.subjectlocation: array exif.flashpixversion: 0100 exif.colorspace: 1 exif.exifimagewidth: 3264 exif.exifimagelength: 2448 exif.sensingmethod: 2 exif.exposuremode: 0 exif.whitebalance: 0 exif.focallengthin35mmfilm: 35 exif.scenecapturetype: 0 gps.gpslatituderef: n gps.gpslatitude: array gps.gpslongituderef: w gps.gpslongitude: array gps.gpsaltituderef: gps.gpsaltitude: 55556/297 gps.gpstimestamp: array gps.gpsimgdirectionref: t gps.gpsimgdirection: 19688/145
here code use php script photos, removed header , requires:
<?php require('[...]'); mysql_select_db($db_name, $oconn); $jobnum = $_post['jobnum']; if ((($_files["file"]["type"] == "image/gif") || ($_files["file"]["type"] == "image/jpeg") || ($_files["file"]["type"] == "image/pjpeg")) && ($_files["file"]["size"] < 10000000)) { if ($_files["file"]["error"] > 0) { ps_log( "bad photo upload - return code: " . $_files["file"]["error"]); } else { ps_log( "upload: " . $_files["file"]["name"]); ps_log( "type: " . $_files["file"]["type"]); ps_log( "size: " . ($_files["file"]["size"] / 1024) . " kb"); ps_log( "temp file: " . $_files["file"]["tmp_name"] . "<br />"); $photoname = $_files['file']['tmp_name']; $root = "[...]"; $location = $_server['document_root'].$root.$photoname; $exif = exif_read_data($photoname, 0, true); $filename = $exif["file"]["filename"]; $model = $exif["ifd0"]["model"]; $date = $exif["ifd0"]["datetime"]; $lon = $exif["gps"]["gpslongitude"]; $lonref = $exif["gps"]['gpslongituderef']; $lat = $exif["gps"]["gpslatitude"]; $latref = $exif["gps"]['gpslatituderef']; $lon = photos::getgps($lon, $lonref); $lat = photos::getgps($lat, $latref); $photo = new uploadedphoto(); $photo->jobnum = $jobnum; $photo->tempfile = $_files["file"]["tmp_name"]; $photo->filename = $_files["file"]["name"]; $photo->comments = $_post['comment']; $photo->model = $model ; $photo->datestamp = $date ; $photo->lat = $lat ; $photo->lng = $lon ; $photo->savegeo(); } } else { echo "invalid file"; } header("[...]");?>
only thing can create native app (or apache cordova app), handle upload. gps data stripped mobile safari. app should upload picture as-is. of there no other way around it.
it may along these lines: http://gonzalo123.com/2013/10/28/taking-photos-with-a-phonegapcordova-application-and-uploading-them-to-the-server/
Comments
Post a Comment