PHP GD,imagecreatefromstring();如何获得图像尺寸?

时间:2020-03-06 14:29:31  来源:igfitidea点击:

通常我使用imagecreatefromjpeg()然后使用getimagesize(),但是对于Firefox 3,我需要绕过这种不同。因此,现在我使用的是" imagecreatefromstring()",但是现在如何获取图像尺寸呢?

解决方案

imagesx()imagesy()函数似乎也适用于用imagecreatefromstring()制成的图像。

没错!我刚刚在互联网上找到答案了:)

对于那些仍然有兴趣的人:

$image = imagecreatefromstring($img_str);
$w = imagesx($image);
$h = imagesy($image);