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

Offline: Image Attachment/Attachment to show/download content after attaching #6165

Closed
3 tasks done
ebruchez opened this issue Jan 29, 2024 · 2 comments
Closed
3 tasks done

Comments

@ebruchez
Copy link
Collaborator

ebruchez commented Jan 29, 2024

Following #5207.

Attachments are saved, however the Image Attachment control cannot show an image that has been attached, both:

  1. just after having attached, which means that we have a File object at our disposal (upload: scheme)
  2. after saving the data, which means that we have no File but a path to the persistence layer

In online mode, an <img> HTML object requests data to the XForms servers, which then proxies this appropriately to either the temporary file or the data from the persistence layer. In offline we do not have a server that can do this kind of proxying.

@ebruchez
Copy link
Collaborator Author

ebruchez commented Jan 29, 2024

When we have a File object, we can use URL.createObjectURL(). This should cover showing the image and downloading the file (with <a download>?).

We could probably make this work even after saving the data.

However, this won't work if the form is closed and reopened, as in that case we have a ReadableStream and that cannot be transformed into a URL. That could be an acceptable limitation as a first step, but not ideal in general.

However:

  • Attachments: we could disable the Download link in such cases.
  • Images: we could read them and transform them into a Blob if they are not too large. After all, they will have to be uncompressed and shown in the browser eventually.
  • Videos: not needed right now; could MediaSource help? For smaller videos, we could do what we do for images. But videos tend to be be much larger than images, in the order of GBs vs. MBs.

ebruchez added a commit that referenced this issue Feb 20, 2024
ebruchez added a commit that referenced this issue Feb 21, 2024
@ebruchez ebruchez changed the title Offline: Image Attachment and Attachment controls to support data retrieval Offline: Image Attachment and Attachment controls to support initial data retrieval Feb 21, 2024
@ebruchez
Copy link
Collaborator Author

Changed title to indicate that the data retrieval now works for attachments in the same session where they have been attached. We don't yet support reading such attachments from persistence in a new form session.

@ebruchez ebruchez changed the title Offline: Image Attachment and Attachment controls to support initial data retrieval Offline: Image Attachment/Attachment to show/download content after attaching Feb 22, 2024
@ebruchez ebruchez added this to Done in Orbeon Forms 2024.1 Feb 22, 2024
@ebruchez ebruchez closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant