If the string is too short, we should treat this the same way as
an unrecognized image type. This function should be usable to
determine whether something is a valid image without doing any
checks beforehand.
- fix leaks and wrong error when invalid/empty string are given to
imagecreatefromstring
- add test for imagecreatefromstring
- add test for palettecopy