Same name in other branches
  1. 7.x-1.x ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::getHumanReadableDescriptions()
  2. 8.x-1.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::getHumanReadableDescriptions()

Convert machine tag values to their human-readable descriptions.

Sources: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html.

File

src/ExifPHPExtension.php, line 536

Class

ExifPHPExtension
Class ExifPHPExtension Parser implementation base d on PHP Exif extension.

Namespace

Drupal\exif

Code

public function getHumanReadableDescriptions() {
    $machineToHuman = [];
    $machineToHuman['componentsconfiguration'] = [
        '0' => $this->t('-'),
        '1' => $this->t('Y'),
        '2' => $this->t('Cb'),
        '3' => $this->t('Cr'),
        '4' => $this->t('R'),
        '5' => $this->t('G'),
        '6' => $this->t('B'),
    ];
    $machineToHuman['compression'] = [
        '1' => $this->t('Uncompressed'),
        '2' => $this->t('CCITT 1D'),
        '3' => $this->t('T4/Group 3 Fax'),
        '4' => $this->t('T6/Group 4 Fax'),
        '5' => $this->t('LZW'),
        '6' => $this->t('JPEG (old-style)'),
        '7' => $this->t('JPEG'),
        '8' => $this->t('Adobe Deflate'),
        '9' => $this->t('JBIG B&W'),
        '10' => $this->t('JBIG Color'),
        '99' => $this->t('JPEG'),
        '262' => $this->t('Kodak 262'),
        '32766' => $this->t('Next'),
        '32767' => $this->t('Sony ARW Compressed'),
        '32769' => $this->t('Packed RAW'),
        '32770' => $this->t('Samsung SRW Compressed'),
        '32771' => $this->t('CCIRLEW'),
        '32773' => $this->t('PackBits'),
        '32809' => $this->t('Thunderscan'),
        '32867' => $this->t('Kodak KDC Compressed'),
        '32895' => $this->t('IT8CTPAD'),
        '32896' => $this->t('IT8LW'),
        '32897' => $this->t('IT8MP'),
        '32898' => $this->t('IT8BL'),
        '32908' => $this->t('PixarFilm'),
        '32909' => $this->t('PixarLog'),
        '32946' => $this->t('Deflate'),
        '32947' => $this->t('DCS'),
        '34661' => $this->t('JBIG'),
        '34676' => $this->t('SGILog'),
        '34677' => $this->t('SGILog24'),
        '34712' => $this->t('JPEG 2000'),
        '34713' => $this->t('Nikon NEF Compressed'),
        '34715' => $this->t('JBIG2 TIFF FX'),
        '34718' => $this->t('Microsoft Document Imaging (MDI) Binary Level Codec'),
        '34719' => $this->t('Microsoft Document Imaging (MDI) Progressive Transform Codec'),
        '34720' => $this->t('Microsoft Document Imaging (MDI) Vector'),
        '65000' => $this->t('Kodak DCR Compressed'),
        '65535' => $this->t('Pentax PEF Compressed'),
    ];
    $machineToHuman['contrast'] = [
        '0' => $this->t('Normal'),
        '1' => $this->t('Low'),
        '2' => $this->t('High'),
    ];
    $machineToHuman['exposuremode'] = [
        '0' => $this->t('Auto'),
        '1' => $this->t('Manual'),
        '2' => $this->t('Auto bracket'),
    ];
    // (the value of 9 is not standard EXIF, but is used by the Canon EOS 7D)
    $machineToHuman['exposureprogram'] = [
        '0' => $this->t('Not Defined'),
        '1' => $this->t('Manual'),
        '2' => $this->t('Program AE'),
        '3' => $this->t('Aperture-priority AE'),
        '4' => $this->t('Shutter speed priority AE'),
        '5' => $this->t('Creative (Slow speed)'),
        '6' => $this->t('Action (High speed)'),
        '7' => $this->t('Portrait'),
        '8' => $this->t('Landscape'),
        '9' => $this->t('Bulb'),
    ];
    $machineToHuman['flash'] = [
        '0' => $this->t('Flash did not fire'),
        '1' => $this->t('Flash fired'),
        '5' => $this->t('Strobe return light not detected'),
        '7' => $this->t('Strobe return light detected'),
        '9' => $this->t('Flash fired, compulsory flash mode'),
        '13' => $this->t('Flash fired, compulsory flash mode, return light not detected'),
        '15' => $this->t('Flash fired, compulsory flash mode, return light detected'),
        '16' => $this->t('Flash did not fire, compulsory flash mode'),
        '24' => $this->t('Flash did not fire, auto mode'),
        '25' => $this->t('Flash fired, auto mode'),
        '29' => $this->t('Flash fired, auto mode, return light not detected'),
        '31' => $this->t('Flash fired, auto mode, return light detected'),
        '32' => $this->t('No flash function'),
        '65' => $this->t('Flash fired, red-eye reduction mode'),
        '69' => $this->t('Flash fired, red-eye reduction mode, return light not detected'),
        '71' => $this->t('Flash fired, red-eye reduction mode, return light detected'),
        '73' => $this->t('Flash fired, compulsory flash mode, red-eye reduction mode'),
        '77' => $this->t('Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected'),
        '79' => $this->t('Flash fired, compulsory flash mode, red-eye reduction mode, return light detected'),
        '89' => $this->t('Flash fired, auto mode, red-eye reduction mode'),
        '93' => $this->t('Flash fired, auto mode, return light not detected, red-eye reduction mode'),
        '95' => $this->t('Flash fired, auto mode, return light detected, red-eye reduction mode'),
    ];
    // (values 1, 4 and 5 are not standard EXIF)
    $machineToHuman['focalplaneresolutionunit'] = [
        '1' => $this->t('None'),
        '2' => $this->t('inches'),
        '3' => $this->t('cm'),
        '4' => $this->t('mm'),
        '5' => $this->t('um'),
    ];
    $machineToHuman['gaincontrol'] = [
        '0' => $this->t('None'),
        '1' => $this->t('Low gain up'),
        '2' => $this->t('High gain up'),
        '3' => $this->t('Low gain down'),
        '4' => $this->t('High gain down'),
    ];
    $machineToHuman['lightsource'] = [
        '0' => $this->t('Unknown'),
        '1' => $this->t('Daylight'),
        '2' => $this->t('Fluorescent'),
        '3' => $this->t('Tungsten (Incandescent)'),
        '4' => $this->t('Flash'),
        '9' => $this->t('Fine Weather'),
        '10' => $this->t('Cloudy'),
        '11' => $this->t('Shade'),
        '12' => $this->t('Daylight Fluorescent'),
        '13' => $this->t('Day White Fluorescent'),
        '14' => $this->t('Cool White Fluorescent'),
        '15' => $this->t('White Fluorescent'),
        '16' => $this->t('Warm White Fluorescent'),
        '17' => $this->t('Standard Light A'),
        '18' => $this->t('Standard Light B'),
        '19' => $this->t('Standard Light C'),
        '20' => $this->t('D55'),
        '21' => $this->t('D65'),
        '22' => $this->t('D75'),
        '23' => $this->t('D50'),
        '24' => $this->t('ISO Studio Tungsten'),
        '255' => $this->t('Other'),
    ];
    $machineToHuman['meteringmode'] = [
        '0' => $this->t('Unknown'),
        '1' => $this->t('Average'),
        '2' => $this->t('Center-weighted average'),
        '3' => $this->t('Spot'),
        '4' => $this->t('Multi-spot'),
        '5' => $this->t('Multi-segment'),
        '6' => $this->t('Partial'),
        '255' => $this->t('Other'),
    ];
    $machineToHuman['orientation'] = [
        '1' => $this->t('Horizontal (normal)'),
        '2' => $this->t('Mirror horizontal'),
        '3' => $this->t('Rotate 180'),
        '4' => $this->t('Mirror vertical'),
        '5' => $this->t('Mirror horizontal and rotate 270 CW'),
        '6' => $this->t('Rotate 90 CW'),
        '7' => $this->t('Mirror horizontal and rotate 90 CW'),
        '8' => $this->t('Rotate 270 CW'),
    ];
    // (the value 1 is not standard EXIF)
    $machineToHuman['resolutionunit'] = [
        '1' => $this->t('None'),
        '2' => $this->t('inches'),
        '3' => $this->t('cm'),
    ];
    $machineToHuman['saturation'] = [
        '0' => $this->t('Normal'),
        '1' => $this->t('Low'),
        '2' => $this->t('High'),
    ];
    $machineToHuman['scenecapturetype'] = [
        '0' => $this->t('Standard'),
        '1' => $this->t('Landscape'),
        '2' => $this->t('Portrait'),
        '3' => $this->t('Night'),
    ];
    // (values 1 and 6 are not standard EXIF)
    $machineToHuman['sensingmethod'] = [
        '1' => $this->t('Monochrome area'),
        '2' => $this->t('One-chip color area'),
        '3' => $this->t('Two-chip color area'),
        '4' => $this->t('Three-chip color area'),
        '5' => $this->t('Color sequential area'),
        '6' => $this->t('Monochrome linear'),
        '7' => $this->t('Trilinear'),
        '8' => $this->t('Color sequential linear'),
    ];
    // (applies to EXIF:ISO tag)
    $machineToHuman['sensitivitytype'] = [
        '0' => $this->t('Unknown'),
        '1' => $this->t('Standard Output Sensitivity'),
        '2' => $this->t('Recommended Exposure Index'),
        '3' => $this->t('ISO Speed'),
        '4' => $this->t('Standard Output Sensitivity and Recommended Exposure Index'),
        '5' => $this->t('Standard Output Sensitivity and ISO Speed'),
        '6' => $this->t('Recommended Exposure Index and ISO Speed'),
        '7' => $this->t('Standard Output Sensitivity, Recommended Exposure Index and ISO Speed'),
    ];
    $machineToHuman['sharpness'] = [
        '0' => $this->t('Normal'),
        '1' => $this->t('Soft'),
        '2' => $this->t('Hard'),
    ];
    $machineToHuman['subjectdistancerange'] = [
        '0' => $this->t('Unknown'),
        '1' => $this->t('Macro'),
        '2' => $this->t('Close'),
        '3' => $this->t('Distant'),
    ];
    $machineToHuman['uncompressed'] = [
        '0' => $this->t('No'),
        '1' => $this->t('Yes'),
    ];
    $machineToHuman['whitebalance'] = [
        '0' => $this->t('Auto'),
        '1' => $this->t('Manual'),
    ];
    return $machineToHuman;
}