Получить EXIF данные о изображении PHP

В php есть функция, которая возвращает EXIF данные о изображении, если они есть. В первом параметре принимает путь к файлы, во втором параметре необходимо передать 0 для полного просмотра всех имеющихся заголовков, в третьем true, чтобы получить ассоциативный массив. В примере ниже, фотография лежит в папке со скриптом, с именем 2022-02-08 10-26-48.JPG, пример кода:

<?php
$exif = exif_read_data('2022-02-08 10-26-48.JPG', 0, true);

print_r($exif);
?>

В моем случае результат такой:

Array
(
    [FILE] => Array
        (
            [FileName] => 2022-02-08 10-26-48.JPG
            [FileDateTime] => 1650551038
            [FileSize] => 3370156
            [FileType] => 2
            [MimeType] => image/jpeg
            [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF
        )

    [COMPUTED] => Array
        (
             => width='4032' height='3024'
            [Height] => 3024
            [Width] => 4032
            [IsColor] => 1
            [ByteOrderMotorola] => 1
            [ApertureFNumber] => f/1.8
            [Thumbnail.FileType] => 2
            [Thumbnail.MimeType] => image/jpeg
        )

    [IFD0] => Array
        (
            [Make] => Apple
            [Model] => iPhone 11 Pro Max
            [Orientation] => 1
            [XResolution] => 72/1
            [YResolution] => 72/1
            [ResolutionUnit] => 2
            [Software] => 15.3
            [DateTime] => 2022:02:08 10:26:48
            [HostComputer] => iPhone 11 Pro Max
            [YCbCrPositioning] => 1
            [Exif_IFD_Pointer] => 230
        )

    [THUMBNAIL] => Array
        (
            [Compression] => 6
            [XResolution] => 72/1
            [YResolution] => 72/1
            [ResolutionUnit] => 2
            [JPEGInterchangeFormat] => 2286
            [JPEGInterchangeFormatLength] => 10026
        )

    [EXIF] => Array
        (
            [ExposureTime] => 1/827
            [FNumber] => 9/5
            [ExposureProgram] => 2
            [ISOSpeedRatings] => 32
            [ExifVersion] => 0232
            [DateTimeOriginal] => 2022:02:08 10:26:48
            [DateTimeDigitized] => 2022:02:08 10:26:48
            [UndefinedTag:0x9010] => +03:00
            [UndefinedTag:0x9011] => +03:00
            [UndefinedTag:0x9012] => +03:00
            [ComponentsConfiguration] => 
            [ShutterSpeedValue] => 37537/3873
            [ApertureValue] => 54823/32325
            [BrightnessValue] => 496373/59543
            [ExposureBiasValue] => 0/1
            [MeteringMode] => 5
            [Flash] => 16
            [FocalLength] => 17/4
            [SubjectLocation] => Array
                (
                    [0] => 2002
                    [1] => 1505
                    [2] => 2213
                    [3] => 1324
                )

            [MakerNote] => Apple iOS
            [SubSecTimeOriginal] => 553
            [SubSecTimeDigitized] => 553
            [FlashPixVersion] => 0100
            [ColorSpace] => 65535
            [ExifImageWidth] => 4032
            [ExifImageLength] => 3024
            [SensingMethod] => 2
            [SceneType] => 
            [ExposureMode] => 0
            [WhiteBalance] => 0
            [FocalLengthIn35mmFilm] => 26
            [SceneCaptureType] => 0
            [UndefinedTag:0xA432] => Array
                (
                    [0] => 807365/524263
                    [1] => 6/1
                    [2] => 9/5
                    [3] => 12/5
                )

            [UndefinedTag:0xA433] => Apple
            [UndefinedTag:0xA434] => iPhone 11 Pro Max back triple camera 4.25mm f/1.8
            [UndefinedTag:0xA460] => 2
        )

)

Так как изображение никак не обрабатывалось, данные наиболее полные.

После небольшой обработки в adobe photoshop, появились дополнительные данные:

Array
(
    [FILE] => Array
        (
            [FileName] => mfdf.jpg
            [FileDateTime] => 1650551864
            [FileSize] => 5614920
            [FileType] => 2
            [MimeType] => image/jpeg
            [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF
        )

    [COMPUTED] => Array
        (
             => width='4032' height='3024'
            [Height] => 3024
            [Width] => 4032
            [IsColor] => 1
            [ByteOrderMotorola] => 1
            [ApertureFNumber] => f/1.8
            [Thumbnail.FileType] => 2
            [Thumbnail.MimeType] => image/jpeg
        )

    [IFD0] => Array
        (
            [ImageWidth] => 4032
            [ImageLength] => 3024
            [BitsPerSample] => Array
                (
                    [0] => 8
                    [1] => 8
                    [2] => 8
                )

            [PhotometricInterpretation] => 2
            [Make] => Apple
            [Model] => iPhone 11 Pro Max
            [Orientation] => 1
            [SamplesPerPixel] => 3
            [XResolution] => 720000/10000
            [YResolution] => 720000/10000
            [ResolutionUnit] => 2
            [Software] => Adobe Photoshop CC 2014 (Windows)
            [DateTime] => 2022:04:21 17:37:42
            [HostComputer] => iPhone 11 Pro Max
            [YCbCrPositioning] => 1
            [Exif_IFD_Pointer] => 324
        )

    [THUMBNAIL] => Array
        (
            [Compression] => 6
            [XResolution] => 72/1
            [YResolution] => 72/1
            [ResolutionUnit] => 2
            [JPEGInterchangeFormat] => 1058
            [JPEGInterchangeFormatLength] => 6502
        )

    [EXIF] => Array
        (
            [ExposureTime] => 1/827
            [FNumber] => 9/5
            [ExposureProgram] => 2
            [ISOSpeedRatings] => 32
            [ExifVersion] => 0232
            [DateTimeOriginal] => 2022:02:08 10:26:48
            [DateTimeDigitized] => 2022:02:08 10:26:48
            [UndefinedTag:0x9010] => +03:00
            [UndefinedTag:0x9011] => +03:00
            [UndefinedTag:0x9012] => +03:00
            [ComponentsConfiguration] => 
            [ShutterSpeedValue] => 37537/3873
            [ApertureValue] => 54823/32325
            [BrightnessValue] => 496373/59543
            [ExposureBiasValue] => 0/1
            [MeteringMode] => 5
            [Flash] => 16
            [FocalLength] => 17/4
            [SubjectLocation] => Array
                (
                    [0] => 2002
                    [1] => 1505
                    [2] => 2213
                    [3] => 1324
                )

            [SubSecTimeOriginal] => 553
            [SubSecTimeDigitized] => 553
            [FlashPixVersion] => 0100
            [ColorSpace] => 65535
            [ExifImageWidth] => 4032
            [ExifImageLength] => 3024
            [SensingMethod] => 2
            [SceneType] => 
            [ExposureMode] => 0
            [WhiteBalance] => 0
            [FocalLengthIn35mmFilm] => 26
            [SceneCaptureType] => 0
            [UndefinedTag:0xA432] => Array
                (
                    [0] => 807365/524263
                    [1] => 6/1
                    [2] => 9/5
                    [3] => 12/5
                )

            [UndefinedTag:0xA433] => Apple
            [UndefinedTag:0xA434] => iPhone 11 Pro Max back triple camera 4.25mm f/1.8
            [UndefinedTag:0xA460] => 2
        )

)

А после сохранения в режиме «Сохранить для WEB», данных стало существенно меньше

Array
(
    [FILE] => Array
        (
            [FileName] => fhrr4900.jpg
            [FileDateTime] => 1650552077
            [FileSize] => 363310
            [FileType] => 2
            [MimeType] => image/jpeg
            [SectionsFound] => IFD0, APP12
        )

    [COMPUTED] => Array
        (
             => width='800' height='600'
            [Height] => 600
            [Width] => 800
            [IsColor] => 1
            [ByteOrderMotorola] => 0
        )

    [APP12] => Array
        (
            [Company] => Ducky
            [Info] => 
        )

)

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *



Рекламный блок, для развития проекта