serialize data:image/png;base64 data type json - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: serialize data:image/png;base64 data type json (/showthread.php?tid=63784) |
serialize data:image/png;base64 data type json - freddy - 12-09-2015 Hello guys, need some guide honestly already post in stackoverflow but nothing respond there so i repost in here, what i have been developing is
Here is demo (please see and tested first) in view file the reason why i make input type="text" to aplicated new revision to old projects Here is my js Code: $('#btnsubmit').on("click", function(e) { and this is my controller Code: $dataURL=$this->input->post('images_crop'); all i have got so far blank image in folder with size 0kb, Thanks for some one reading, vote up, vote down, comments RE: serialize data:image/png;base64 data type json - freddy - 12-09-2015 Shit happend to me, i forget to remove old documentasi what i have got from <a href="http://stackoverflow.com/questions/16196879/send-canvas-and-form-to-server-save-image-with-custom-name">Here</a> <code> $dataURL=$this->input->post('images_crop'); // $dataURL = $_POST["imageData"]; this should send to the hell cause spend long time $dataURL = str_replace('data:image/png;base64,', '', $dataURL); $dataURL = str_replace(' ', '+', $dataURL); $image = base64_decode($dataURL); $filename = date("d-m-Y-h-i-s") . '.' . 'png'; //renama file name based on time $path = set_realpath('uploads/product/'); file_put_contents($path. $filename, $image); </code> Thanks any one will reblog it later on /*-------------Solved-------------*/ |