现在有很多文件格式(音频,视频,图像,文本) . 我希望编写一个php代码,可以获取文件的元数据,而不管其格式如何 .
要获取基本元数据(文件名,文件大小,文件类型和上次修改日期),可以使用文件系统API:
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// files is a FileList of File objects. List some properties.
var output = [];
for (var i = 0, f; f = files[i]; i++) {
output.push('
', escape(f.name), ' (', f.type || 'n/a', ') - ',f.size, ' bytes, last modified: ',
f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
'
');}
document.getElementById('list').innerHTML = '
- ' + output.join('') + '
}
document.getElementById('files').addEventListener('change', handleFileSelect, false);
但是,我希望提取 every damn possible thing 我可以设法从文件中提取(每个可能的元数据) .
例如:对于jpg图像,在提取其元数据时,我得到(使用exif标签):
FILE.FileName: idfo1.jpg
FILE.FileDateTime: 1369637595
FILE.FileSize: 126948
FILE.FileType: 2
FILE.MimeType: image/jpeg
FILE.SectionsFound: ANY_TAG, IFD0, EXIF
COMPUTED.html: width="915" height="1246"
COMPUTED.Height: 1246
COMPUTED.Width: 915
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.ApertureFNumber: f/2.6
COMPUTED.UserComment:
IFD0.ImageWidth: 2048
IFD0.ImageLength: 1536
IFD0.Make: SAMSUNG
IFD0.Model: GT-S5830
IFD0.Software: S5830DXKPD
IFD0.DateTime: 2012:06:06 10:18:24
IFD0.YCbCrPositioning: 1
IFD0.Exif_IFD_Pointer: 2232
IFD0.UndefinedTag:0xEA1C: ê
EXIF.ExposureTime: 1/229
EXIF.FNumber: 26/10
EXIF.ExposureProgram: 3
EXIF.ISOSpeedRatings: 50
EXIF.ExifVersion: 0220
EXIF.DateTimeOriginal: 2012:06:06 10:18:24
EXIF.DateTimeDigitized: 2012:06:06 10:18:24
EXIF.MaxApertureValue: 30/10
EXIF.MeteringMode: 3
EXIF.Flash: 0
EXIF.FocalLength: 355/100
EXIF.UserComment:
EXIF.ColorSpace: 1
EXIF.ExifImageWidth: 2048
EXIF.ExifImageLength: 1536
EXIF.ExposureMode: 0
EXIF.WhiteBalance: 0
EXIF.SceneCaptureType: 0
EXIF.UndefinedTag:0xEA1C: ê
如果可能的话,我希望得到地理标记数据 .
同样,对于视频和音频类型文件,我希望得到:
比特率(音频和视频)
持续时间
文件创建日期
评论
框架尺寸等
是否有任何 php 或 javascript 代码可以直接为我这样做?