Open Nummer987 opened 8 years ago
You need to pass that save
object in the new Darkroom
call:
function yourFunction(base64Blob){
//Here you do whatever you want with the base64 string
}
new Darkroom('#target', {
...
// Plugins options
plugins: {
crop: {
minHeight: 50,
minWidth: 50,
ratio: 1
},
save: {
callback: function() {
this.darkroom.selfDestroy(); // Cleanup
var newImage = dkrm.sourceCanvas.toDataURL();
yourFunction(newImage)
}
}
},
});
yourFunction
receives newImage
, that is a base64
string, then you can set it as src
of an <img>
tag or post it via AJAX to a php script to save it to file.
Thats the last part of the githug discription. It says you ahve to edit this code: save: { callback: function() { this.darkroom.selfDestroy(); // Cleanup var newImage = dkrm.canvas.toDataURL(); fileStorageLocation = newImage; } } but where do you have to implement it? Need help :/