Is there a relatively simple way (perhaps regular expressions?) of detecting the dimensions -height & width - of an image from a base64 string (and perhaps the filesize)
Decode the base64, and use getimagesizefromstring().
getimagesizefromstring()
http://www.php.net/manual/en/function.getimagesizefromstring.php
This will be way more reliable than trying to write your own handling of each image type available.