forked from treehouse/mastodon
[Glitch] Fix client-side resizing of image uploads
Port f178a01c11
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
rebase/4.0.0rc2
parent
26b249ad2d
commit
4e9794f533
|
@ -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
|
// and return an all-white image instead. Assume reading failed if the resized
|
||||||
// image is perfectly white.
|
// image is perfectly white.
|
||||||
const imageData = context.getImageData(0, 0, width, height);
|
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';
|
throw 'Failed to read from canvas';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue