Been going through the cropper JavaScript plugin for cropping images for days. Can't figure it out. I'm a php person and JavaScript looks like Greek to me. Seems all the examples I've seen from google search assume the reader actually are familiar with JavaScript and I'm not. My challenge is which of the cropper methods actually stores the dataurl and how do I retrieve it to pass to a php script for processing into an image or to a JavaScript function to display on the same page as an image.
Asked
Active
Viewed 1,516 times
1 Answers
2
From the README.md on their github, it looks like you call this:
var dataURL = $().cropper('getCroppedCanvas').toDataURL('image/jpeg');
https://github.com/fengyuanchen/cropper/blob/master/README.md

delboy1978uk
- 12,118
- 2
- 21
- 39
-
Thanks for the quick response. I assume your code will output the cropped image to the current page and that would be progress for me. But I have one more question. In the documentation I Dont see how this image dataurl is attached to an HTML form and sent to a php script for uploading. Could you pls show me how this done. Once I know how to upload cropped image to server and retrieve it in php I can handle the rest. The blob method doesn't work for my browsers. Thanks – stephen taire Sep 26 '17 at 16:17
-
1Wanted some Hans holding cos I really suck at JavaScript. Didn't get it but delboy1978uk pointed me in the right direction and now the cropper is working. Thanks a lot. – stephen taire Sep 26 '17 at 22:51
-
Also found this answer useful for how to upload dataurl to server using php. In case someone else is stuck https://stackoverflow.com/questions/13198131/how-to-save-an-html5-canvas-as-an-image-on-a-server – stephen taire Sep 27 '17 at 00:09
-
glad i could help! – delboy1978uk Sep 27 '17 at 08:49
-
Nice catch sir. – Shahrukh Anwar Jan 15 '19 at 12:06