我真的不明白为什么 GD 具有不同的加载图像的功能,例如:
imagecreatefromjpeg()
imagecreatefrompng()
imagecreatefromgif()
如果图像是字符串,则只有一个函数?
imagecreatefromstring()
事实上,将图像读入字符串并将其传递给函数要好得多,例如:
$imgBlob = file_get_contents($imagePath);
imagecreatefromstring($imageBlob);
unset($imgBlob); //> Free memory, but I am not interested in memory consumpation
? 或者我错过了什么?这可能会给新用户带来潜在的困惑
也许他们只是忘了创建一个函数imageCreateFromFile()
?
附言。当然我对使用该file_get_contents
方法的内存消耗不感兴趣