Skip to content

Error: TypeError: data.image.toBlob is not a function #114

@yourchoice

Description

@yourchoice

When I upload a file image, i get this error

Error: TypeError: data.image.toBlob is not a function

$('.wrapper').on('change', 'input[type=file]', function(e) {
loadImage(e.target.files[0], { meta: true })
  .then(function (data) {
    if (!data.imageHead) throw new Error('Could not parse image metadata')
    return new Promise(function (resolve) {
      data.image.toBlob(function (blob) {
        data.blob = blob
        resolve(data)
      }, 'image/jpeg')
    })
  })
  .then(function (data) {
    //here i try to get data.blob
  })
  .catch(function (err) {
    console.error(err)
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions