Upload cropped image to server if the browser supports `HTMLCanvasElement.toBlob`Ĭropper.getCroppedCanvas(). Using this application means BlackBerry users can crop their favorite images and upload them directly to social networking websites like Facebook or Flickr, or even to your blog while your on the move. ![]() Get the Cropper.js instance after initialized CropIt v1.2 by ALL KAPPS Software is a nifty little application that lets you edit your images right from your BlackBerry Smartphone. The reason why I'm using ready and not built as suggested many times is because it just doesn't work for me with built at all. Here's the code I'm using.Ĭheck that I also do a console.log just to see that right before making the ajax call, the size of the CropBox is the desired one (and what I get logged as a result is fine, but it's still not the size of the saved image afterwards). Explanation of the terms above: Blob: A binary large object (BLOB) is a collection of binary data stored as a single entity. Or at least someone could tell where I should dig more regarding php, ajax etc. Here was some sort of solution, but maybe there is a simpler solution. After you can use HTMLCanvasElement.toBlob to get a blob and upload it to the server with FormData. Now I am trying to get the cropped image uploaded on the server. I desire all my images that are the result of cropping part of a bigger image to have that size. The getCroppedCanvas method gets a canvas drawn from the cropped image. I have a fixed crop box with aspect ratio 1 and 160 x 160 pixels. Upload cropped image to server Please note that the image will be uploaded to a third-party fake API server, which means that the upload process will sometimes fail. This is a problem because I need to display that cropped version elsewhere in 160x160 and if it was saved in let's say 80x80, when I try to display it, it's blured/pixeled because of a quality issue. Now I am trying to get the cropped image uploaded on the server. ![]() When I trigger the event to upload the cropped selection on a new image, sometimes it uploads me an image of 160x160 (as desired) and sometimes it uploads me a smaller square image. I'm writting here now because I have a very weird problem and I can't find issues where other people might be experiencing the same. First of all, thanks for this library, it's awesome.
0 Comments
Leave a Reply. |