您好,我正在尝试使用php如下旋转图像,我在base64和rotaciono中获得了图像,但是当我尝试再次将图像变成base64错误时,这出现了吗?
$img64=$_POST['IMG'];
$img = str_replace('data:image/jpeg;base64,', '', $img64);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$source = imagecreatefromstring($data);
$rotate = imagerotate($source, 90, 0); // if want to rotate the image
$data = base64_encode($rotate);//ERROR
错误:
<b>Warning</b>: base64_encode() expects parameter 1 to be string, resource given in <b>C:\EasyPHP-DevServer-13.1VC9\data\localweb\projects\STEP\php\rotateLand.php</b> on line <b>9</b><br />
您正在尝试将图像对象传递给base64_encode,该对象仅使用字符串作为参数。
看看这个问题,关于图像的对象转换为字符串base64编码。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句