Publicidad

Obtener información de una imagen en PHP


Por Alex el 22/06/2020, Comentar el artículo

Comparte este artículo:      




En PHP con la función exif_read_data podemos obtener los meta-datos que tiene guardada la imagen como fecha de creación, dimensiones, tamaño, etc ...


La forma de acceder a esta información es muy sencilla

$exif = exif_read_data('índice.jpeg', 0, true);
En la variable $exif tenemos la información de la imagen.

Algo similar a:

Array
(
    [FileName] => IMG_20180802_132530.jpg
    [FileDateTime] => 1533209131
    [FileSize] => 4850937
    [FileType] => 2
    [MimeType] => image/jpeg
    [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP
    [COMPUTED] => Array
        (
            [html] => width="3888" height="5184"
            [Height] => 5184
            [Width] => 3888
            [IsColor] => 1
            [ByteOrderMotorola] => 0
            [ApertureFNumber] => f/2.0
            [Thumbnail.FileType] => 2
            [Thumbnail.MimeType] => image/jpeg
        )

    [ImageDescription] => 
    [Make] => CUBOT
    [Model] => CUBOT_X18_Plus
    [Orientation] => 1
    [XResolution] => 72/1
    [YResolution] => 72/1
    [ResolutionUnit] => 2
    [Software] => MediaTek Camera Application
    [DateTime] => 2018:08:02 13:25:31
    [YCbCrPositioning] => 2
    [UndefinedTag:0x0220] => 0
    [UndefinedTag:0x0221] => 0
    [UndefinedTag:0x0222] => 0
    [UndefinedTag:0x0223] => 0
    [UndefinedTag:0x0224] => 1
    [UndefinedTag:0x0225] => 
    [Exif_IFD_Pointer] => 414
    [THUMBNAIL] => Array
        (
            [Compression] => 6
            [Orientation] => 1
            [XResolution] => 72/1
            [YResolution] => 72/1
            [ResolutionUnit] => 2
            [JPEGInterchangeFormat] => 1268
            [JPEGInterchangeFormatLength] => 7515
            [YCbCrPositioning] => 2
        )

    [ExposureTime] => 19997/1000000
    [FNumber] => 20/10
    [ExposureProgram] => 0
    [ISOSpeedRatings] => 80
    [ExifVersion] => 0220
    [DateTimeOriginal] => 2018:08:02 13:25:31
    [DateTimeDigitized] => 2018:08:02 13:25:31
    [ComponentsConfiguration] => 
    [ExposureBiasValue] => 0/10
    [MeteringMode] => 2
    [LightSource] => 255
    [Flash] => 0
    [FocalLength] => 350/100
    [SubSecTime] => 26
    [SubSecTimeOriginal] => 26
    [SubSecTimeDigitized] => 26
    [FlashPixVersion] => 0100
    [ColorSpace] => 1
    [ExifImageWidth] => 3888
    [ExifImageLength] => 5184
    [InteroperabilityOffset] => 918
    [ExposureMode] => 0
    [WhiteBalance] => 0
    [DigitalZoomRatio] => 100/100
    [SceneCaptureType] => 0
    [InterOperabilityIndex] => R98
    [InterOperabilityVersion] => 0100
)


Y esto es todo, y feliz programming
Saludos
Alex.



Si te ha gustado el artículo compartelo en:      




Añadir un comentarios:

Nombre:
Email: (no se publica el email)




SIGUENOS EN

ARCHIVO

Publicidad

.