dfa1234 / ngx-image-compress

Angular library for uploading and compressing images
https://image-library.app
MIT License
86 stars 37 forks source link

generateUploadInputNative does not set the input element's Accept property to 'image/*' #98

Closed daxtron2 closed 1 year ago

daxtron2 commented 1 year ago

In the InputRenderer version, it creates an upload input like so

const inputElement = render.createElement('input');
render.setStyle(inputElement, 'display', 'none');
render.setProperty(inputElement, 'type', 'file');
render.setProperty(inputElement, 'accept', 'image/*');

whereas in the native version (that gets used by iOS apps like the one I'm working on) it doesn't

const inputElement = documentNativeApi.createElement('input');
inputElement.id = 'upload-input' + new Date();
inputElement.style.display = 'none';
inputElement.setAttribute('type', 'file');

In the context of the app i'm working on, this allows the UI to prompt the user to upload videos as well as images. When uploading an image it crashes our app due to not having the permission for videos. I think this should be an easy change to just include another inputElement.setAttribute('accept', 'image/*'); which I can do a PR for if you'd like but I wanted to post here first to see if there was any reasoning behind not having that in there or if there's something else I'm missing. Thanks in advance!

dfa1234 commented 1 year ago

Look good to me, please submit a PR

dfa1234 commented 1 year ago

Implement in version 13.1.14 (available soon)

dfa1234 commented 1 year ago

https://github.com/dfa1234/ngx-image-compress/pull/99

dfa1234 commented 1 year ago

https://github.com/dfa1234/ngx-image-compress/releases/tag/lib-13.1.14

daxtron2 commented 1 year ago

Thanks for getting the fix out for this so quick, greatly appreciated!