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

Feature: Camera plugin should return file size #1872

Open
kentora opened this issue Nov 1, 2023 · 2 comments · May be fixed by #1873
Open

Feature: Camera plugin should return file size #1872

kentora opened this issue Nov 1, 2023 · 2 comments · May be fixed by #1873

Comments

@kentora
Copy link

kentora commented Nov 1, 2023

Feature Request

Plugin

Camera

Description

In order to validate selected files, it is common to check that the file is not too large. From camera we might not have much control over this, but from the photo gallery it's possible to select a large saved image.

Platform(s)

iOS, Android, Web

Preferred Solution

Add a 'size' field on the return object

Alternatives

Could be appended the exif object, but given that is not very well defined to begin with, I think it's better to have a separate field.

Additional Context

@dtarnawsky
Copy link
Contributor

The returned object already contains the file (base64 encoded). So, couldn't you just use that for the size of the file? If you need exact byte size you could decode it.

@kentora
Copy link
Author

kentora commented Nov 13, 2023

The returned object might contain the file, base64 encoded, depending on what CameraResultType you pass in the call. It might also just be the path or a webpath, and you would need to use the file API to read the file, before continuing.
Yes, i could read the file from the drive afterwards, but reading the file an extra time just to ensure the size seems unnecessary, and in the plugin we already have the size handy.

Another solution might be to always return the base64, but that must have been decided against for some reason...

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

Successfully merging a pull request may close this issue.

3 participants