Enlcxx / angular2-resizing-cropping-image

Resize, rotate and crop images(cropper) for Angular 8
https://alyle.io/components/image-cropper
32 stars 6 forks source link

How can I upload result with cropped image to server? #23

Open Nareth123 opened 3 years ago

Nareth123 commented 3 years ago

Hi builder, I am very appreciate your work done with this Angular image cropping. I have implemented your package to Angular with working on cropping feature but I don't know to apply upload function to server after cropped. I can't find the file new file of cropped image to upload. My project is Angular 11 I want to upload the cropped image to my server via API (Django RESTFramework).

Can you give me the guideline or any example of code to make it done? The attachment is snap from error.

I am looking forward to see your replying Capture

Enlcxx commented 3 years ago

Hi @Nareth123, thanks for the appreciation.

The output of the image cropped is in Data URI e.g. data:image/png;base64,iVB...., so you must convert it to a format that is supported for your API.

You can do a google search e.g. javascript data URI to blob or javascript data URL to blob.