fopen('rb'); $data = @exif_read_data($fileDescriptor, 'ANY_TAG', true); $size = new FileMetadata(); $size->setGroupName('size'); $size->setId($file->getId()); $size->setMetadata([]); if (!$data) { return [ 'size' => $size, ]; } if (array_key_exists('COMPUTED', $data) && array_key_exists('Width', $data['COMPUTED']) && array_key_exists('Height', $data['COMPUTED']) ) { $size->setMetadata([ 'width' => $data['COMPUTED']['Width'], 'height' => $data['COMPUTED']['Height'], ]); } return [ 'size' => $size, ]; } public static function getMimetypesSupported(): string { return '/image\/.*/'; } }