Commit Graph

11 Commits

Author SHA1 Message Date
ThibG d8d43a427a
Fix image uploads being random data when canvas read access is blocked (#15180)
Fixes #15178

PR #11499 introduced a way to deal with all-white canvas, but newer
Firefox versions set random data instead.

This PR detects whether canvas operations are reliable by comparing
the results on a hardcoded 2×2 pixels image, and memoizing the result.

This should be both more reliable and faster than the previous check.
2020-11-18 18:01:58 +01:00
ThibG be637146f3
Fix uninformative error message when uploading unsupported image files (#13540)
Attempting to upload image files that the browser is unable to load results
in “Oops! An unexpected error occurred.”

This commit changes the error handling so that an unprocessable image results
in the file being sent anyway, which might cover a few corner cases, and
provide a slightly better error message.
2020-04-25 12:27:29 +02:00
ThibG a1ce9cbb67
Fix uploaded image orientation in some browsers (#13493)
Some browsers (at least recent Chrome versions) automatically take
image metadata into account when drawing images into a canvas.
There seem to be no way to prevent that behavior, and the only
way to detect it seems to compare with a known image.

See: https://github.com/w3c/csswg-drafts/issues/4666
Solution adapted from: 1e4df70782
2020-04-18 15:37:03 +02:00
Stanislas 5d8ee24cd5 Remove WebP support (#11589) 2019-08-17 22:04:15 +02:00
ThibG f178a01c11 Fix client-side resizing of image uploads (#11570)
Fixes #11567
2019-08-15 11:52:26 +02:00
ThibG 111a0628fc Fix image uploads being perfectly white when canvas read access is blocked (#11499)
Fixes #11496
2019-08-06 12:08:19 +02:00
Acid Chicken (硫酸鶏) 5092d17f29 Add WebP support (#9879)
* Add WebP support

* Remove the changes to the tooltip

refs: https://github.com/tootsuite/mastodon/pull/9879#pullrequestreview-199312528
2019-02-02 12:25:04 +01:00
Eugen Rochko 0fb0037ca7
Resize images by area instead of fixed dimensions (#8083)
To improve the way super tall or super ride images are treated, the
numbers remain the same, 1280x1280 and 400x400, but if an image
is less in one dimension than the other, the other can become larger

Thanks to @WAHa_06x36@mastodon.social for the tip
2018-07-28 03:33:00 +02:00
Eugen Rochko 2b97451168
Fix images resized in browser getting cropped (#7514)
Fix #7487
2018-05-16 16:24:16 +02:00
Yamagishi Kazutoshi 6832110af4 Correct rotate of image using EXIF (#7422) 2018-05-09 08:41:07 +02:00
Yamagishi Kazutoshi 0758b00bfd Refactor resizeImage method (#7236)
- Use URL.createObjectURL (replace from FileReader)
- Use HTMLCanvasElement.prototype.toBlob
  (replace from HTMLCanvasElement.prototype.toDataURL)
- Use Promise (replace callback interface)
2018-04-23 09:15:51 +02:00