matiasgali / guillotine

jQuery plugin to crop images within an area (fully responsive), allowing to drag (touch support), zoom and rotate.
http://guillotine.js.org
326 stars 100 forks source link

Doesnt work with base64-Imagesource #38

Closed jprhamburg closed 9 years ago

matiasgali commented 9 years ago

@jprhamburg, for an issue to be taken seriously you need to add a description and enough context to reproduce and debug it.

I opened the demo page, waited for the full-size image to be loaded and pasted the following code in the browser's console to convert the image to data, the plugin works perfectly.

var img = $('#sample_picture')[0], canvas, ctx, dataURL

// Remove existing Guillotine instance
$(img).guillotine('remove')

// Get data URL
canvas = document.createElement('canvas')
canvas.height = img.height
canvas.width  = img.width
ctx = canvas.getContext('2d')
ctx.drawImage(img, 0, 0)
dataURL = canvas.toDataURL('image/png');

// Change src and build a new Guillotine instance
$(img).on('load', function() {
  $(img).guillotine({eventOnChange: 'guillotinechange'});
})
img.src = dataURL

If this works please let me know or close the issue, if it doesn't provide code and context to reproduce the issue and I'll work on it.

matiasgali commented 9 years ago

Closing for inactivity.