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)? That is to say without actually creating an image resource?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Decode the base64, and use 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.