about summary refs log tree commit diff
path: root/app/javascript/mastodon/utils/resize_image.js
AgeCommit message (Collapse)Author
2020-11-18Fix image uploads being random data when canvas read access is blocked (#15180)ThibG
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-04-25Fix uninformative error message when uploading unsupported image files (#13540)ThibG
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-18Fix uploaded image orientation in some browsers (#13493)ThibG
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: https://github.com/blueimp/JavaScript-Load-Image/commit/1e4df707821a0afcc11ea0720ee403b8759f3881
2019-08-17Remove WebP support (#11589)Stanislas
2019-08-15Fix client-side resizing of image uploads (#11570)ThibG
Fixes #11567
2019-08-06Fix image uploads being perfectly white when canvas read access is blocked ↵ThibG
(#11499) Fixes #11496
2019-02-02Add WebP support (#9879)Acid Chicken (硫酸鶏)
* Add WebP support * Remove the changes to the tooltip refs: https://github.com/tootsuite/mastodon/pull/9879#pullrequestreview-199312528
2018-07-28Resize images by area instead of fixed dimensions (#8083)Eugen Rochko
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-05-16Fix images resized in browser getting cropped (#7514)Eugen Rochko
Fix #7487
2018-05-09Correct rotate of image using EXIF (#7422)Yamagishi Kazutoshi
2018-04-23Refactor resizeImage method (#7236)Yamagishi Kazutoshi
- Use URL.createObjectURL (replace from FileReader) - Use HTMLCanvasElement.prototype.toBlob (replace from HTMLCanvasElement.prototype.toDataURL) - Use Promise (replace callback interface)