Closed nicovitt closed 3 years ago
Good insight. Since you already have the proper environment and all the key of the problems, I propose you to make send a PR, that I will publish via npm. If not I will make the correction myself, but I need organize some time, test from iOS, etc... Whatever is the case: thank :)
We ran into an issue where it is not working in iOS. We built an angular PWA and Safari has some issues by listening to the change event. There were no problems in Chrome or Firefox. We found this related issue (https://stackoverflow.com/questions/47664777/javascript-file-input-onchange-not-working-ios-safari-only) and fixed the corresponding file "ngx-image-compress.js". Right before
inputElement.click()
in theuploadFile()
method we implementeddocument.getElementById("mediacontainer").appendChild(inputElement);
. For iOS the file has to be actually in the DOM so we append it to an element. Perhaps evendocument.appendChild(inputElement);
would work but we haven't tested this.Would it be possible to add this or something like this to your existing implementation?
Thanks, Nico
Heyy tried this method out but it didnt work for me. Would u mind sharing the code to see how u implement it if its working correctly
Adding document.body.appendChild(inputElement);
before inputElement.click();
in ngx-image-compress.js worked for me. I tested my app in iOS and Android devices and the issue seems to be solved. Thank you @nicovitt.
Done in the new version 11.0.2
.
Oh boys. Didn't get the notification that I was mentioned here. Sorry for the late response. Thanks for implementing the fix @dfa1234 !
We ran into an issue where it is not working in iOS. We built an angular PWA and Safari has some issues by listening to the change event. There were no problems in Chrome or Firefox. We found this related issue (https://stackoverflow.com/questions/47664777/javascript-file-input-onchange-not-working-ios-safari-only) and fixed the corresponding file "ngx-image-compress.js". Right before
inputElement.click()
in theuploadFile()
method we implementeddocument.getElementById("mediacontainer").appendChild(inputElement);
. For iOS the file has to be actually in the DOM so we append it to an element. Perhaps evendocument.appendChild(inputElement);
would work but we haven't tested this.Would it be possible to add this or something like this to your existing implementation?
Thanks, Nico