if($img= imagecreatefromstring(base64_decode($_POST['image']))) { imagejpeg($img, 'img.jpeg'); imagedestroy($img); }