Hello,

I am adding gps information to an image with PEL. I noticed that if I rotate
an image using Windows Photo Viewer, add the gps info with PEL, and save the
image to a new file that the new file is rotated back the original way. I am
doing something wrong? is there a way to avoid this? thanks -peter

$jpeg = new PelJpeg($imageFileName);
$exif = $jpeg->getExif();
$tiff = $exif->getTiff();
$ifd0 = $tiff->getIfd();
 $gps = new PelIfd(PelIfd::GPS);
$ifd0->addSubIfd($gps);
 $gps->addEntry(new PelEntryAscii(PelTag::GPS_LATITUDE,
$gpsCoordinate['latitude']));
if($gpsCoordinate['latitude'] >= 0) {
$gps->addEntry(new PelEntryAscii(PelTag::GPS_LATITUDE_REF, "N"));
} else {
$gps->addEntry(new PelEntryAscii(PelTag::GPS_LATITUDE_REF, "S"));
}
 $gps->addEntry(new PelEntryAscii(PelTag::GPS_LONGITUDE,
$gpsCoordinate['longitude']));
if($gpsCoordinate['longitude'] >= 0) {
$gps->addEntry(new PelEntryAscii(PelTag::GPS_LONGITUDE_REF, "E"));
} else {
$gps->addEntry(new PelEntryAscii(PelTag::GPS_LONGITUDE_REF, "W"));
}
 $gps->addEntry(new PelEntryAscii(PelTag::GPS_SPEED,
$gpsCoordinate['speed']));
// kilometers/hour
$gps->addEntry(new PelEntryAscii(PelTag::GPS_SPEED_REF, "K"));
 $gps->addEntry(new PelEntryAscii(PelTag::GPS_ALTITUDE,
$gpsCoordinate['elevation']));
if($gpsCoordinate['speed'] >= 0) {
// above sea level
$gps->addEntry(new PelEntryAscii(PelTag::GPS_ALTITUDE_REF, 0));
} else {
// below sea level
$gps->addEntry(new PelEntryAscii(PelTag::GPS_ALTITUDE_REF, 1));
}
$gps->addEntry(new PelEntryAscii(PelTag::GPS_PROCESSING_METHOD, "MANUAL"));
 $gps->addEntry(new PelEntryAscii(PelTag::GPS_TIME_STAMP,
$gpsCoordinate['time_stamp']));

file_put_contents('C:\Users\peter\Desktop\test.jpg', $jpeg->getBytes());
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
PEL-devel mailing list
PEL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel

Reply via email to