Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chosenFile with initial image #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
petrmifek wants to merge 1 commit into zhanziyang:master
base: master
Choose a base branch
Loading
from edmstudio:edm-chosen-file

Conversation

@petrmifek
Copy link

@petrmifek petrmifek commented Nov 6, 2019

When a file was chosen more than once (incl. when using initial image), the reset function would destroy the information about the currently chosen file (this.getChosenFile() === null)

The change tries to keep the chosenFile around so that the getChosenFile returns the last file chosen (as expected).

Copy link

Neophen commented Jan 13, 2020

Hmm i can't get the build to work and i need this fix

Copy link
Author

I'm using just a git checkout of the repo and it works ok (for my use anyway), you might try that meanwhile...

Copy link

Neophen commented Jan 14, 2020
edited
Loading

I've built it with node v10 and replaced the dist folder in my project with the built one, i stop seeing the new image on chooseFile.
Can you show me how you're using croppa in your project?

also with doing that i get:

[Vue warn]: Error in v-on handler (Promise/async): "SecurityError: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported."

Could you possibly share your fork of this and how you managed to setup this in your project i would be very grateful!

Copy link
Author

petrmifek commented Jan 14, 2020
edited
Loading

I'm actually using it in a Quasar project, which in turn uses Webpack (I think). So it packs it up for me I guess. As for the setup, it's just a basic git checkout, then importing it like:

import 'components/vendor/vue-croppa/dist/vue-croppa.css'
import Croppa from 'components/vendor/vue-croppa/src/cropper.vue'
...
 components: {
 Croppa: Croppa,
 },
...

EDIT: I also rebuilt the dist and pushed into edm-master branch in our for here, if you want to try that one: https://github.com/edmstudio/vue-croppa/tree/edm-master

Copy link

Neophen commented Jan 15, 2020
edited
Loading

Ok so works fine for when not using initialImage, on choosing more files.
but if i set initial image, then it keeps throwing:
[Vue warn]: Error in v-on handler (Promise/async): "SecurityError: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported."
when trying to convert get the blob of the chosen file.

Any ideas of why that happens?

I've worked around this by not setting initial image and just showing the current image as a workaround. Since initial image causes too much trouble.

Copy link
Author

That's likely a different issue - check CORS headers returned from the server hosting the initial image, also try setting crossorigin="anonymous" prop in croppa.

BTW if still having trouble, feel free to make an (separate) issue not to divert this PR that much. If you have some sample code having that issue, I could have a look there. Thanks!

Copy link

Neophen commented Jan 17, 2020

Thank you @petrmifek your fix is working and i've decided against using initial image prop. it's just causing to much issues, so i simply render an image in an image tag. as i didn't really want the initial image to be editable anyways.

Thank you this has helped me!

petrmifek reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /