X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fmedia%2FExif.php;h=95fa8594fc0f0f235ca43c20efa91de2562d2398;hp=052c39df56f189a9305ee2fff9da46a3bb32e607;hb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;hpb=3de7e73bd0f0ddf5d7c38fd46edfae96d1a64e40 diff --git a/includes/media/Exif.php b/includes/media/Exif.php index 052c39df56..95fa8594fc 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -116,13 +116,13 @@ class Exif { * * @link http://exif.org/Exif2-2.PDF The Exif 2.2 specification */ - $this->mExifTags = array( + $this->mExifTags = [ # TIFF Rev. 6.0 Attribute Information (p22) - 'IFD0' => array( + 'IFD0' => [ # Tags relating to image structure 'ImageWidth' => Exif::SHORT_OR_LONG, # Image width 'ImageLength' => Exif::SHORT_OR_LONG, # Image height - 'BitsPerSample' => array( Exif::SHORT, 3 ), # Number of bits per component + 'BitsPerSample' => [ Exif::SHORT, 3 ], # Number of bits per component # "When a primary image is JPEG compressed, this designation is not" # "necessary and is omitted." (p23) 'Compression' => Exif::SHORT, # Compression scheme #p23 @@ -130,7 +130,7 @@ class Exif { 'Orientation' => Exif::SHORT, # Orientation of image #p24 'SamplesPerPixel' => Exif::SHORT, # Number of components 'PlanarConfiguration' => Exif::SHORT, # Image data arrangement #p24 - 'YCbCrSubSampling' => array( Exif::SHORT, 2 ), # Subsampling ratio of Y to C #p24 + 'YCbCrSubSampling' => [ Exif::SHORT, 2 ], # Subsampling ratio of Y to C #p24 'YCbCrPositioning' => Exif::SHORT, # Y and C positioning #p24-25 'XResolution' => Exif::RATIONAL, # Image resolution in width direction 'YResolution' => Exif::RATIONAL, # Image resolution in height direction @@ -145,11 +145,11 @@ class Exif { # Tags relating to image data characteristics 'TransferFunction' => Exif::IGNORE, # Transfer function - 'WhitePoint' => array( Exif::RATIONAL, 2 ), # White point chromaticity - 'PrimaryChromaticities' => array( Exif::RATIONAL, 6 ), # Chromaticities of primarities + 'WhitePoint' => [ Exif::RATIONAL, 2 ], # White point chromaticity + 'PrimaryChromaticities' => [ Exif::RATIONAL, 6 ], # Chromaticities of primarities # Color space transformation matrix coefficients #p27 - 'YCbCrCoefficients' => array( Exif::RATIONAL, 3 ), - 'ReferenceBlackWhite' => array( Exif::RATIONAL, 6 ), # Pair of black and white reference values + 'YCbCrCoefficients' => [ Exif::RATIONAL, 3 ], + 'ReferenceBlackWhite' => [ Exif::RATIONAL, 6 ], # Pair of black and white reference values # Other tags 'DateTime' => Exif::ASCII, # File change date and time @@ -159,10 +159,10 @@ class Exif { 'Software' => Exif::ASCII, # Software used 'Artist' => Exif::ASCII, # Person who created the image 'Copyright' => Exif::ASCII, # Copyright holder - ), + ], # Exif IFD Attribute Information (p30-31) - 'EXIF' => array( + 'EXIF' => [ # @todo NOTE: Nonexistence of this field is taken to mean nonconformance # to the Exif 2.1 AND 2.2 standards 'ExifVersion' => Exif::UNDEFINED, # Exif version @@ -174,8 +174,8 @@ class Exif { # Tags relating to image configuration 'ComponentsConfiguration' => Exif::UNDEFINED, # Meaning of each component #p33 'CompressedBitsPerPixel' => Exif::RATIONAL, # Image compression mode - 'PixelYDimension' => Exif::SHORT_OR_LONG, # Valid image width - 'PixelXDimension' => Exif::SHORT_OR_LONG, # Valid image height + 'PixelYDimension' => Exif::SHORT_OR_LONG, # Valid image height + 'PixelXDimension' => Exif::SHORT_OR_LONG, # Valid image width # Tags relating to related user information 'MakerNote' => Exif::IGNORE, # Manufacturer notes @@ -209,13 +209,13 @@ class Exif { 'LightSource' => Exif::SHORT, # Light source #p40-41 'Flash' => Exif::SHORT, # Flash #p41-42 'FocalLength' => Exif::RATIONAL, # Lens focal length - 'SubjectArea' => array( Exif::SHORT, 4 ), # Subject area + 'SubjectArea' => [ Exif::SHORT, 4 ], # Subject area 'FlashEnergy' => Exif::RATIONAL, # Flash energy 'SpatialFrequencyResponse' => Exif::IGNORE, # Spatial frequency response. Not supported atm. 'FocalPlaneXResolution' => Exif::RATIONAL, # Focal plane X resolution 'FocalPlaneYResolution' => Exif::RATIONAL, # Focal plane Y resolution 'FocalPlaneResolutionUnit' => Exif::SHORT, # Focal plane resolution unit #p46 - 'SubjectLocation' => array( Exif::SHORT, 2 ), # Subject location + 'SubjectLocation' => [ Exif::SHORT, 2 ], # Subject location 'ExposureIndex' => Exif::RATIONAL, # Exposure index 'SensingMethod' => Exif::SHORT, # Sensing method #p46 'FileSource' => Exif::UNDEFINED, # File source #p47 @@ -237,22 +237,22 @@ class Exif { 'SubjectDistanceRange' => Exif::SHORT, # Subject distance range #p51 'ImageUniqueID' => Exif::ASCII, # Unique image ID - ), + ], # GPS Attribute Information (p52) - 'GPS' => array( + 'GPS' => [ 'GPSVersion' => Exif::UNDEFINED, # Should be an array of 4 Exif::BYTE's. However php treats it as an undefined # Note exif standard calls this GPSVersionID, but php doesn't like the id suffix 'GPSLatitudeRef' => Exif::ASCII, # North or South Latitude #p52-53 - 'GPSLatitude' => array( Exif::RATIONAL, 3 ), # Latitude + 'GPSLatitude' => [ Exif::RATIONAL, 3 ], # Latitude 'GPSLongitudeRef' => Exif::ASCII, # East or West Longitude #p53 - 'GPSLongitude' => array( Exif::RATIONAL, 3 ), # Longitude + 'GPSLongitude' => [ Exif::RATIONAL, 3 ], # Longitude 'GPSAltitudeRef' => Exif::UNDEFINED, # Altitude reference. Note, the exif standard says this should be an EXIF::Byte, # but php seems to disagree. 'GPSAltitude' => Exif::RATIONAL, # Altitude - 'GPSTimeStamp' => array( Exif::RATIONAL, 3 ), # GPS time (atomic clock) + 'GPSTimeStamp' => [ Exif::RATIONAL, 3 ], # GPS time (atomic clock) 'GPSSatellites' => Exif::ASCII, # Satellites used for measurement 'GPSStatus' => Exif::ASCII, # Receiver status #p54 'GPSMeasureMode' => Exif::ASCII, # Measurement mode #p54-55 @@ -265,9 +265,9 @@ class Exif { 'GPSImgDirection' => Exif::RATIONAL, # Direction of image 'GPSMapDatum' => Exif::ASCII, # Geodetic survey data used 'GPSDestLatitudeRef' => Exif::ASCII, # Reference for latitude of destination #p56 - 'GPSDestLatitude' => array( Exif::RATIONAL, 3 ), # Latitude destination + 'GPSDestLatitude' => [ Exif::RATIONAL, 3 ], # Latitude destination 'GPSDestLongitudeRef' => Exif::ASCII, # Reference for longitude of destination #p57 - 'GPSDestLongitude' => array( Exif::RATIONAL, 3 ), # Longitude of destination + 'GPSDestLongitude' => [ Exif::RATIONAL, 3 ], # Longitude of destination 'GPSDestBearingRef' => Exif::ASCII, # Reference for bearing of destination #p57 'GPSDestBearing' => Exif::RATIONAL, # Bearing of destination 'GPSDestDistanceRef' => Exif::ASCII, # Reference for distance to destination #p57-58 @@ -276,8 +276,8 @@ class Exif { 'GPSAreaInformation' => Exif::UNDEFINED, # Name of GPS area 'GPSDateStamp' => Exif::ASCII, # GPS date 'GPSDifferential' => Exif::SHORT, # GPS differential correction - ), - ); + ], + ]; $this->file = $file; $this->basename = wfBaseName( $this->file ); @@ -306,7 +306,7 @@ class Exif { * when somebody uploads a file called something.jpeg * containing random gibberish. */ - $this->mRawExifData = $data ?: array(); + $this->mRawExifData = $data ?: []; $this->makeFilteredData(); $this->collapseData(); $this->debugFile( __FUNCTION__, false ); @@ -316,7 +316,7 @@ class Exif { * Make $this->mFilteredExifData */ function makeFilteredData() { - $this->mFilteredExifData = array(); + $this->mFilteredExifData = []; foreach ( array_keys( $this->mRawExifData ) as $section ) { if ( !array_key_exists( $section, $this->mExifTags ) ) { @@ -395,7 +395,7 @@ class Exif { if ( isset( $this->mFilteredExifData['ComponentsConfiguration'] ) ) { $val = $this->mFilteredExifData['ComponentsConfiguration']; - $ccVals = array(); + $ccVals = []; $strLen = strlen( $val ); for ( $i = 0; $i < $strLen; $i++ ) { @@ -666,7 +666,7 @@ class Exif { * @return bool */ private function isRational( $in ) { - $m = array(); + $m = []; # Avoid division by zero if ( !is_array( $in ) @@ -711,7 +711,7 @@ class Exif { * @return bool */ private function isSrational( $in ) { - $m = array(); + $m = []; # Avoid division by zero if ( !is_array( $in ) &&