ternandsparrow / wild-orchid-watch-pwa

Progressive Web App for the Wild Orchid Watch citizen science project
https://app.wildorchidwatch.org
4 stars 4 forks source link

Large photos cause RangeError: Array buffer allocation failed #51

Closed tomsaleeba closed 3 years ago

tomsaleeba commented 3 years ago

Env: PWA mode in Chrome 80.0 on Android 8, LG V30, Version: c909f07.20200330-115627

Steps:

Expected: Things generally work

Actual: From the user's perspective, everything works but there's a warning in the console:

chunk-vendors.860c66a0.js:219 Failed to compress a photo with MIME=image/jpeg, size=26114557 and EXIF={"ImageWidth":12000,"ImageHeight":9000,"Make":"samsung","Model":"SM-G988B","Orientation":1,"XResolution":72,"YResolution":72,"ResolutionUnit":2,"Software":"G988BXXU1ATB4","DateTime":"2020:02:12 11:49:58","YCbCrPositioning":1,"ExifIFDPointer":226,"ExposureTime":0.0011904761904761906,"FNumber":1.8,"ExposureProgram":"Normal program","ISOSpeedRatings":50,"ExifVersion":"0220","DateTimeOriginal":"2020:02:12 11:49:58","DateTimeDigitized":"2020:02:12 11:49:58","ShutterSpeedValue":0.0011904761904761906,"ApertureValue":1.69,"BrightnessValue":22.73,"ExposureBias":0,"MaxApertureValue":1.69,"MeteringMode":"CenterWeightedAverage","Flash":"Flash did not fire","FocalLength":7,"ColorSpace":1,"PixelXDimension":12000,"PixelYDimension":9000,"ExposureMode":0,"WhiteBalance":"Auto white balance","DigitalZoomRation":1,"FocalLengthIn35mmFilm":25,"SceneCaptureType":"Standard","ImageUniqueID":"SA8XLMF00SM","thumbnail":{"ImageWidth":512,"ImageHeight":384,"Compression":6,"XResolution":72,"YResolution":72,"ResolutionUnit":2,"JpegIFOffset":762,"JpegIFByteCount":54544,"blob":{}}}. Falling back to original image. RangeError: Array buffer allocation failed
    at new ArrayBuffer (<anonymous>)
    at new Uint8Array (<anonymous>)
    at l (/js/1.509a56f2.worker.js:14)
    at h (/js/1.509a56f2.worker.js:14)
    at new t (/js/1.509a56f2.worker.js:14)
    at Object.n [as image/jpeg] (/js/1.509a56f2.worker.js:21)
    at r.d (/js/1.509a56f2.worker.js:36)
    at r.value (/js/1.509a56f2.worker.js:36)
    at new r (/js/1.509a56f2.worker.js:36)
    at a (/js/1.509a56f2.worker.js:1)

We could check the size of the photo before we try to resize it and if we know it's too big then we don't try. Or we could just leave it and as browsers improve, it might go away.

tomsaleeba commented 3 years ago

No longer an issue as the affected code (and functionality) has been removed.