Copy the SVG detection from SVGCoder to the utils
This commit is contained in:
parent
4acd81177b
commit
ac4dcbe316
|
@ -17,6 +17,7 @@
|
|||
|
||||
// Currently Image/IO does not support WebP
|
||||
#define kSDUTTypeWebP ((__bridge CFStringRef)@"public.webp")
|
||||
#define kSVGTagEnd @"</svg>"
|
||||
|
||||
@implementation NSData (ImageContentType)
|
||||
|
||||
|
@ -74,6 +75,15 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
case 0x3C: {
|
||||
if (data.length > 100) {
|
||||
// Check end with SVG tag
|
||||
NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(data.length - 100, 100)] encoding:NSASCIIStringEncoding];
|
||||
if ([testString containsString:kSVGTagEnd]) {
|
||||
return SDImageFormatSVG;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SDImageFormatUndefined;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue