[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/media/ -> Exif.php (summary)

Extraction and validation of image metadata. 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.

Author: Ævar Arnfjörð Bjarmason <[email protected]>
Copyright: Copyright © 2005, Ævar Arnfjörð Bjarmason, 2009 Brent Garber
License: http://www.gnu.org/copyleft/gpl.html GNU General Public License
File Size: 858 lines (29 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Exif:: (20 methods):
  __construct()
  makeFilteredData()
  collapseData()
  charCodeString()
  exifPropToOrd()
  exifGPStoNumber()
  getData()
  getFilteredData()
  version()
  isByte()
  isASCII()
  isShort()
  isLong()
  isRational()
  isUndefined()
  isSlong()
  isSrational()
  validate()
  debug()
  debugFile()


Class: Exif  - X-Ref

Class to extract and validate Exif data from jpeg (and possibly tiff) files.

__construct( $file, $byteOrder = '' )   X-Ref
Constructor

param: string $file Filename.
param: string $byteOrder Type of byte ordering either 'BE' (Big Endian)

makeFilteredData()   X-Ref
Make $this->mFilteredExifData


collapseData()   X-Ref
Collapse some fields together.
This converts some fields from exif form, to a more friendly form.
For example GPS latitude to a single number.

The rationale behind this is that we're storing data, not presenting to the user
For example a longitude is a single number describing how far away you are from
the prime meridian. Well it might be nice to split it up into minutes and seconds
for the user, it doesn't really make sense to split a single number into 4 parts
for storage. (degrees, minutes, second, direction vs single floating point number).

Other things this might do (not really sure if they make sense or not):
Dates -> mediawiki date format.
convert values that can be in different units to be in one standardized unit.

As an alternative approach, some of this could be done in the validate phase
if we make up our own types like Exif::DATE.

charCodeString( $prop )   X-Ref
Do userComment tags and similar. See pg. 34 of exif standard.
basically first 8 bytes is charset, rest is value.
This has not been tested on any shift-JIS strings.

param: string $prop Prop name

exifPropToOrd( $prop )   X-Ref
Convert an Exif::UNDEFINED from a raw binary string
to its value. This is sometimes needed depending on
the type of UNDEFINED field

param: string $prop Name of property

exifGPStoNumber( $prop )   X-Ref
Convert gps in exif form to a single floating point number
for example 10 degress 20`40`` S -> -10.34444

param: string $prop A GPS coordinate exif tag name (like GPSLongitude)

getData()   X-Ref
Get $this->mRawExifData

return: array

getFilteredData()   X-Ref
Get $this->mFilteredExifData

return: array

version()   X-Ref
The version of the output format

Before the actual metadata information is saved in the database we
strip some of it since we don't want to save things like thumbnails
which usually accompany Exif data. This value gets saved in the
database along with the actual Exif data, and if the version in the
database doesn't equal the value returned by this function the Exif
data is regenerated.

return: int

isByte( $in )   X-Ref
Validates if a tag value is of the type it should be according to the Exif spec

param: mixed $in The input value to check
return: bool

isASCII( $in )   X-Ref

param: mixed $in The input value to check
return: bool

isShort( $in )   X-Ref

param: mixed $in The input value to check
return: bool

isLong( $in )   X-Ref

param: mixed $in The input value to check
return: bool

isRational( $in )   X-Ref

param: mixed $in The input value to check
return: bool

isUndefined( $in )   X-Ref

param: mixed $in The input value to check
return: bool

isSlong( $in )   X-Ref

param: mixed $in The input value to check
return: bool

isSrational( $in )   X-Ref

param: mixed $in The input value to check
return: bool

validate( $section, $tag, $val, $recursive = false )   X-Ref
Validates if a tag has a legal value according to the Exif spec

param: string $section Section where tag is located.
param: string $tag The tag to check.
param: mixed $val The value of the tag.
param: bool $recursive True if called recursively for array types.
return: bool

debug( $in, $fname, $action = null )   X-Ref
Convenience function for debugging output

param: mixed $in Arrays will be processed with print_r().
param: string $fname Function name to log.
param: string|bool|null $action Default null.

debugFile( $fname, $io )   X-Ref
Convenience function for debugging output

param: string $fname The name of the function calling this function
param: bool $io Specify whether we're beginning or ending



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1