class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
$data = $myBase64DataFromDb; if (preg_match('/^data:image\/(\w+);base64,/', $data, $type)) { $data = substr($data, strpos($data, ',') + 1); $type = strtolower($type[1]); // jpg, png, gif $data = base64_decode($data); $path = '/img/put/here/'; $filename = $data.'.'.$type; $handle = new upload($filename); $handle->file_max_size = '5000000'; $handle->image_resize = true; $handle->image_x = 600; $handle->image_ratio_y = true; $handle->process($path); if ($handle->processed) { echo $filename; $handle->clean(); } else { echo 'error : ' . $handle->error; } }
How can I use this class to use that data, resize and store on my server?
So far I've gotten this far: