Hello I'm trying to rotate an image with php as follows, I get the image in base64 and rotaciono, but when I try to turn it again into a base64 error as I do that emerges?
$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
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 />