Ver Fonte

Merge pull request #892 from DJWassink/patch-1

Updated ThumbnailGenerator to work with IE
Renée Kooi há 6 anos atrás
pai
commit
4132fccb8a
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      src/plugins/ThumbnailGenerator/index.js

+ 3 - 1
src/plugins/ThumbnailGenerator/index.js

@@ -105,7 +105,9 @@ module.exports = class ThumbnailGenerator extends Plugin {
 
     image = this.protect(image)
 
-    var steps = Math.ceil(Math.log2(image.width / targetWidth))
+    // Use the Polyfill for Math.log2() since IE doesn't support log2
+    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2#Polyfill
+    var steps = Math.ceil(Math.log(image.width / targetWidth) * Math.LOG2E)
     if (steps < 1) {
       steps = 1
     }