matiasgali/guillotine

Doesnt work with base64-Imagesource

jprhamburg opened this issue · 2 comments

Doesnt work with base64-Imagesource

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

  • What doesn't work precisely?
  • How are you creating the data URL and setting image 'src'?
  • What browser, jQuery and Guillotine versions are you using?

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.

Closing for inactivity.