Skip to content
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

Accessing the transformed image #981

Closed
1 task done
jw7712 opened this issue May 16, 2024 · 2 comments
Closed
1 task done

Accessing the transformed image #981

jw7712 opened this issue May 16, 2024 · 2 comments

Comments

@jw7712
Copy link

jw7712 commented May 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Is there an easy way to access the transformed image on the processfile event?
I'm using the vue plugin (in vue3) and i'm building an app that should work offline.
The uploading is working correctly when connected to the internet.
However i'm trying to implement a custom function to store images to indexedDb to retry uploading in the background.
When storing the file in indexedDb the original file is stored instead of the transformed image.
Is there a way to access the transformed image instead of the original image?

function processFile(error, file, metadata, collection_name) { //if error is not null, add the file to the queue if (error) { //add to queue for background syncing if syncing fails this.saveQueueFile('file', file, 'report', {collection_name: collection_name, report_uuid: this.report.uuid}); //add the local file to the files array if (!this.files[collection_name]) { this.files[collection_name] = []; } this.files[collection_name].push(file);

Describe alternatives you've considered

github copilot suggested this:
`function processFileWrapper(error, file, metadata) {
reportStore.processFile(error, file, metadata, props.item.id);

console.log('myFilePond', myFilePond.value);
myFilePond.value.getFileEncodeDataURL(file.id, (dataURL) => {
    console.log('Transformed file data URL:', dataURL);
});`

However, i'm getting an error in my console:
myFilePond.value.getFileEncodeDataURL is not a function

(I'm using the composition api with script setup)
@rikschennink

@rikschennink
Copy link
Collaborator

That would require adding the file encode plugin, and it would trigger re-processing of the image.

When using Pintura this is imageEditorAfterWriteImage but that doesn't work here.

Maybe you can use onpreparefile it returns the original and the output.

@jw7712
Copy link
Author

jw7712 commented May 23, 2024

Thank you Rik for your helpfull response and pointing me in the right direction.
I'm using onpreparefile now to store the image.
Thanks for the great package and support!

@jw7712 jw7712 closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants