I tried PhotoEditorSDK : export to server without auto download?, but that did not help me. The following code still downloads the file to the client.
By the time I get to the then
part of the export promise, the act of exporting has already downloaded the file to the client even though I've explicitly stated that editor.export.download = false
.
Have I misunderstood something in the export part?
If I set editor.enableExport: true
, I must listen to the editor.on('export')
event. This works fine, except that the data delivered to this event is the original image data, and not the manipulated data present inside the editor. By exporting manually, I get the rendered content, but it ignores the download flag. :-(
P.S. Console states that I'm using v4.1.0 of PhotoEditorSDK.
this.editor = new PhotoEditorDesktopUI({
container: this.el.nativeElement,
license: license,
assets: {
baseUrl: '/assets/photoeditorsdk' // see angular-cli.json for configuraton
},
responsive: true,
style: {
width: '100%',
height: '100%'
},
editor: {
image: this.image,
enableExport: false,
export: {
download: false
}
},
});
this.editor.export(
PhotoEditorSDK.RenderType.DATAURL, // Export as `Image` object
PhotoEditorSDK.ImageFormat.JPEG, // Export as JPEG
0.8 // JPEG quality: 80%
).then((data) => {
// Do something with the imagedata
});
This part of the documentation is wrong. The export
function now takes a single argument download
of type Boolean
. So in order to export the image, you'll need to do the following:
this.editor.export(false)
.then((data) => {
// Do something with the imagedata
});
The export format, file type and quality are now controlled via the editor options.