判断图片的类型(图片是data类型 )

+ (NSString *)typeForImageData:(NSData *)data {

uint8_t c;

[data getBytes:&c length:1];

switch (c) {

case 0xFF:

return @"image/jpeg";

case 0x89:

return @"image/png";

case 0x47:

return @"image/gif";

case 0x49:

case 0x4D:

return @"image/tiff";

}

return nil;

}

上一篇:PHP filter例子


下一篇:HBase(六): HBase体系结构剖析(上)