metadata php,使用php提取文件的元数据

现在有很多文件格式(音频,视频,图像,文本) . 我希望编写一个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 代码可以直接为我这样做?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值