brunobar79 / J-I-C

J I C is a Javascript Image Compressor using HTML5 Canvas & File API that allows you to compress your jpeg & png images before uploading to the server (100% client-side and no extra libraries required!)
http://makeitsolutions.com/labs/jic/
MIT License
857 stars 196 forks source link

Not working in firefox #26

Closed nicky-lenaers closed 8 years ago

nicky-lenaers commented 8 years ago

I'm using the library to compress images. I started with creating the source element like so:

var img_elem = document.createElement('img');
    img_elem.src = canvas.toDataURL();

The img_elem, when logged, shows that the element actually has the src attribute filled, so up to this point it all works.

Then, I put it through the compressor:

var compressed = document.createElement('img');
    compressed.src = jic.compress(img_elem, 90, 'jpg').src;

Now, when I log compressed it shows:

<img src="data:,">
brunobar79 commented 8 years ago

Does the same code and image work in chrome? Also, could you post a gist of the entire script and specify in which version doesn't work?

Thanks.

On Monday, February 15, 2016, Nicky Lenaers notifications@github.com wrote:

I'm using the library to compress images. I started with creating the source element like so:

var img_elem = document.createElement('img'); img_elem.src = canvas.toDataURL();

The img_elem, when logged, shows that the element actually has the src attribute filled, so up to this point it all works.

Then, I put it through the compressor:

var compressed = document.createElement('img'); compressed.src = jic.compress(img_elem, 90, 'jpg').src;

Now, when I log compressed it shows:

— Reply to this email directly or view it on GitHub https://github.com/brunobar79/J-I-C/issues/26.

nicky-lenaers commented 8 years ago

Ah, apologies! I was using another angular plugin for image cropping which was right before I compressed it. It seemed the output of the image cropper is already corrupted, so this compressor is not to blame. Closing this issue!