As title, I found that the ImageTypeDetector::parseType method is very complicated for detecting different image formats.
The image formats have different approach about reading byte lengths.
To enhance parseType method, my following suggestions are as follows:
Split different methods from parseType methods to detect different images.
Read constraint bytes can detect every different image formats because we can make sure that the magic bytes should be included in these specific const bytes.
For example, we can read 30 bytes firstly then using substr to check the magic bytes are located in current indexes currently.
As title, I found that the
ImageTypeDetector::parseType
method is very complicated for detecting different image formats.The image formats have different approach about reading byte lengths.
To enhance
parseType
method, my following suggestions are as follows:parseType
methods to detect different images.30
bytes firstly then usingsubstr
to check the magic bytes are located in current indexes currently.What do you think about this, @odan?