]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix client-side resizing of image uploads
authorThibG <thib@sitedethib.com>
Thu, 15 Aug 2019 09:52:26 +0000 (11:52 +0200)
committerThibaut Girka <thib@sitedethib.com>
Mon, 19 Aug 2019 19:49:39 +0000 (21:49 +0200)
Port f178a01c11a4af077926dd035a0c4c44f6b3985c to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
app/javascript/flavours/glitch/util/resize_image.js

index a8ec5f3fa767286042c9da1084dca64e960584af..d566edb0323f9bf0485af07bc1034f7a6e304649 100644 (file)
@@ -71,7 +71,7 @@ const processImage = (img, { width, height, orientation, type = 'image/png' }) =
   // and return an all-white image instead. Assume reading failed if the resized
   // image is perfectly white.
   const imageData = context.getImageData(0, 0, width, height);
-  if (imageData.every(value => value === 255)) {
+  if (imageData.data.every(value => value === 255)) {
     throw 'Failed to read from canvas';
   }