[英]Get size of base64 image without saving it
如何在不使用imagecreatefromstring
和PHP的情况下获取base64图像的大小(例如450000字节),而不用将其保存?
FileInfo可以为您完成此操作。它返回有关字符串缓冲区的信息。因此imagecreatefromstring()
是可靠的
$encoded_string = "the string";
$imgdata = base64_decode($encoded_string);
$f = finfo_open();
$mime_type = finfo_buffer($f, $imgdata, FILEINFO_MIME_TYPE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.