summaryrefslogtreecommitdiff
path: root/includes/media/XMP.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/media/XMP.php')
-rw-r--r--includes/media/XMP.php62
1 files changed, 48 insertions, 14 deletions
diff --git a/includes/media/XMP.php b/includes/media/XMP.php
index 0dbf5632..36660b3d 100644
--- a/includes/media/XMP.php
+++ b/includes/media/XMP.php
@@ -1,5 +1,27 @@
<?php
/**
+ * Reader for XMP data containing properties relevant to images.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Media
+ */
+
+/**
* Class for reading xmp data containing properties relevant to
* images, and spitting out an array that FormatExif accepts.
*
@@ -191,10 +213,16 @@ class XMPReader {
unset( $data['xmp-special'] );
// Convert GPSAltitude to negative if below sea level.
- if ( isset( $data['xmp-exif']['GPSAltitudeRef'] ) ) {
- if ( $data['xmp-exif']['GPSAltitudeRef'] == '1'
- && isset( $data['xmp-exif']['GPSAltitude'] )
- ) {
+ if ( isset( $data['xmp-exif']['GPSAltitudeRef'] )
+ && isset( $data['xmp-exif']['GPSAltitude'] )
+ ) {
+
+ // Must convert to a real before multiplying by -1
+ // XMPValidate guarantees there will always be a '/' in this value.
+ list( $nom, $denom ) = explode( '/', $data['xmp-exif']['GPSAltitude'] );
+ $data['xmp-exif']['GPSAltitude'] = $nom / $denom;
+
+ if ( $data['xmp-exif']['GPSAltitudeRef'] == '1' ) {
$data['xmp-exif']['GPSAltitude'] *= -1;
}
unset( $data['xmp-exif']['GPSAltitudeRef'] );
@@ -439,13 +467,15 @@ class XMPReader {
* generally means we've finished processing a nested structure.
* resets some internal variables to indicate that.
*
- * Note this means we hit the </closing element> not the </rdf:Seq>.
+ * Note this means we hit the closing element not the "</rdf:Seq>".
*
- * For example, when processing:
+ * @par For example, when processing:
+ * @code{,xml}
* <exif:ISOSpeedRatings> <rdf:Seq> <rdf:li>64</rdf:li>
* </rdf:Seq> </exif:ISOSpeedRatings>
+ * @endcode
*
- * This method is called when we hit the </exif:ISOSpeedRatings> tag.
+ * This method is called when we hit the "</exif:ISOSpeedRatings>" tag.
*
* @param $elm String namespace . space . tag name.
*/
@@ -501,15 +531,17 @@ class XMPReader {
* Hit a closing element in MODE_LI (either rdf:Seq, or rdf:Bag )
* Add information about what type of element this is.
*
- * Note we still have to hit the outer </property>
+ * Note we still have to hit the outer "</property>"
*
- * For example, when processing:
+ * @par For example, when processing:
+ * @code{,xml}
* <exif:ISOSpeedRatings> <rdf:Seq> <rdf:li>64</rdf:li>
* </rdf:Seq> </exif:ISOSpeedRatings>
+ * @endcode
*
- * This method is called when we hit the </rdf:Seq>.
+ * This method is called when we hit the "</rdf:Seq>".
* (For comparison, we call endElementModeSimple when we
- * hit the </rdf:li>)
+ * hit the "</rdf:li>")
*
* @param $elm String namespace . ' ' . element name
*/
@@ -988,7 +1020,7 @@ class XMPReader {
* Also does some initial set up for the wrapper element
*
* @param $parser XMLParser
- * @param $elm String namespace <space> element
+ * @param $elm String namespace "<space>" element
* @param $attribs Array attribute name => value
*/
function startElement( $parser, $elm, $attribs ) {
@@ -1071,11 +1103,13 @@ class XMPReader {
* Process attributes.
* Simple values can be stored as either a tag or attribute
*
- * Often the initial <rdf:Description> tag just has all the simple
+ * Often the initial "<rdf:Description>" tag just has all the simple
* properties as attributes.
*
- * Example:
+ * @par Example:
+ * @code
* <rdf:Description rdf:about="" xmlns:exif="http://ns.adobe.com/exif/1.0/" exif:DigitalZoomRatio="0/10">
+ * @endcode
*
* @param $attribs Array attribute=>value array.
*/