FIX: Workaround Safari 15 createImageBitmap bug (#14448)

FIX: Workaround Safari 15 createImageBitmap bug (#14448)

diff --git a/app/assets/javascripts/discourse/app/lib/media-optimization-utils.js b/app/assets/javascripts/discourse/app/lib/media-optimization-utils.js
index ad581f0..cd73d05 100644
--- a/app/assets/javascripts/discourse/app/lib/media-optimization-utils.js
+++ b/app/assets/javascripts/discourse/app/lib/media-optimization-utils.js
@@ -1,9 +1,11 @@
 import { Promise } from "rsvp";
+import { isAppleDevice } from "discourse/lib/utilities";
 
 // Chrome and Firefox use a native method to do Image -> Bitmap Array (it happens of the main thread!)
-// Safari uses the `<img async>` element due to https://bugs.webkit.org/show_bug.cgi?id=182424
+// Safari < 15 uses the `<img async>` element due to https://bugs.webkit.org/show_bug.cgi?id=182424
+// Safari > 15 still uses `<img async>` due to their buggy createImageBitmap not handling EXIF rotation
 async function fileToDrawable(file) {
-  if ("createImageBitmap" in self) {
+  if ("createImageBitmap" in self && !isAppleDevice()) {
     return await createImageBitmap(file);
   } else {
     const url = URL.createObjectURL(file);

GitHub sha: 1c73b97d508fd79e6c8eff0cc8a44bdc5084f4a7

This commit appears in #14448 which was approved by markvanlan and pmusaraj. It was merged by Falco.