Commit Graph

75 Commits

Author SHA1 Message Date
Guo Xiang Tan 142571bba0 Remove use of `rescue nil`.
* `rescue nil` is a really bad pattern to use in our code base.
  We should rescue errors that we expect the code to throw and
  not rescue everything because we're unsure of what errors the
  code would throw. This would reduce the amount of pain we face
  when debugging why something isn't working as expexted. I've
  been bitten countless of times by errors being swallowed as a
  result during debugging sessions.
2018-04-02 13:52:51 +08:00
Guo Xiang Tan 226ace1643 Update annotations. 2018-02-20 14:28:58 +08:00
Sam c42bb94362 PERF: slow down optimizing images per host 2018-01-24 08:53:17 +11:00
Sam bfd052a317 PERF: guard so we only create one optimized image per process
This protectd sidekiq and other cases where optimized images are created on
demand so they do not dominate the machine.
2018-01-24 08:22:28 +11:00
Arpit Jalan daeb7694bc update annotations 2017-12-05 21:03:20 +05:30
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Régis Hanol c7c93e7159 FEATURE: new 'strip image metadata' site setting 2017-07-25 11:48:39 +02:00
Régis Hanol aa69f78fed let's not use progressing rendering on images 2017-06-26 23:19:48 +02:00
Régis Hanol 6e5c59e5ec FIX: image orientation wasn't properly working 2017-06-22 16:53:49 +02:00
Robin Ward cdbe027c1c Refactor `FileHelper` to use keyword arguments. 2017-05-24 13:54:26 -04:00
Régis Hanol 9641d2413d REFACTOR: upload workflow creation into UploadCreator
- Automatically convert large-ish PNG/BMP to JPEG
- Updated fast_image to latest version
2017-05-11 00:16:57 +02:00
Robin Ward 24e1892d28 Silence logs for OptimizedImage failures 2017-05-09 14:59:46 -04:00
Guo Xiang Tan ddc8abf9d8 Fix broken optimize image command. 2017-03-20 15:07:38 +08:00
Guo Xiang Tan e7c972ac89 FIX: Don't use backticks that take in inputs. 2017-03-17 15:33:51 +08:00
Régis Hanol c4552ef8c1 slightly shorter regexp for OptimizedImage.safe_path? 2017-01-02 16:28:14 +01:00
Sam 15b5fddd49 SECURITY: protect upload params, only allow very strict filenames 2016-12-19 10:16:18 +11:00
Guo Xiang Tan e4b75f604c FIX: Make clean up upload script a safer task to run. 2016-09-05 10:06:02 +08:00
Guo Xiang Tan efd7cbd887 Remove limit default.
Having the limit makes it harder to migrate all `Upload`/`OptimizedImage`
since the count has to be figured out and passed to the method.
2016-09-02 10:55:11 +08:00
Régis Hanol 11172b7c2d FIX: cropping GIF wasn't working 2016-07-27 18:48:02 +02:00
Régis Hanol 667dd54a23 FEATURE: new 'crop_tall_images' site setting 2016-05-23 16:18:30 +02:00
Marcus Rückert 320d5d64e8 Use sRGB Color Profile when converting images
With the conversion done when uploading or fetching an image we also
lose any embedded color profiles. [This leads to images possibly not rendered
properly in the browsers.][1] To fix the issue we tell imagemagick to render
the image from the embedded color profile to sRGB, which is the color
space used by most browsers.

RT_sRGB.icm is taken from the [RawTherapee repository][2] and is licensed as Public Domain.

[1]: https://meta.discourse.org/t/image-embedded-color-profile/40519
[2]: https://github.com/Beep6581/RawTherapee/blob/master/rtdata/iccprofiles/output/RT_sRGB.icm
2016-03-07 23:42:33 +01:00
Sam 32c681c96b annotate models 2016-02-23 10:33:53 +11:00
Régis Hanol 5c0fb34eee FIX: resize emoji job was generate errors 2015-10-30 23:31:30 +01:00
Régis Hanol a3831a7003 FIX: uploading an animated user card/profile background was converted to a still image 2015-09-20 22:01:03 +02:00
Régis Hanol ffbaf8c542 FEATURE: automatically downsize large images 2015-08-12 18:33:13 +02:00
Régis Hanol d456460d33 FIX: don't butcher GIFs
Use 'gifsicle' instead of 'convert' to resize & optimize GIFs

FIX: don't even try to fix GIFs orientation
FIX: use 'allow_animated_thumbnails' site setting for user profile backgrounds & user cards
2015-07-22 17:10:42 +02:00
Régis Hanol 87ab1cef8e FIX: destroy optimized images that cant' be migrated to new scheme
Since we can always recompute an optimized image from the original upload, there's no need to keep optimized images that are generating errors.
2015-06-15 18:30:11 +02:00
Régis Hanol bc9fd2c46d don't silence these errors 2015-06-12 20:11:23 +02:00
Régis Hanol 189cb3ff12 FEATURE: move migrate_to_new_scheme into a background job
- new hidden site setting 'migrate_to_new_scheme' (defaults to false)
- new rake tasks to toggle migration to new scheme
- FIX: migrate_to_new_scheme also works with CDN
- PERF: improve perf of the DbHelper.remap method
- REFACTOR: UrlHelper is now a class
2015-06-12 12:07:57 +02:00
Régis Hanol a52d31e25e FIX: properly handle external image download errors 2015-06-10 18:18:20 +02:00
Régis Hanol bdfdbcd217 FIX: we need the sha of the upload to create a thumbnail 2015-06-10 18:15:10 +02:00
Régis Hanol 803083fc2e we don't care about convert output/errors 2015-06-04 19:16:52 +02:00
Régis Hanol 81a699e2b0 better support for mixed content 2015-06-01 17:49:58 +02:00
Sam Saffron 97f03e699d FIX: mixed local s3 store missing avatars 2015-06-01 11:17:42 +10:00
Régis Hanol 14a9a98c5b FIX: need to reload the file once optimized 2015-05-29 13:02:05 +02:00
Régis Hanol 555b5cb055 FIX: optimized images were *not* optimized... (:fired:) 2015-05-29 10:58:27 +02:00
Régis Hanol 8e7bfd0f29 FIX: automatically growing uploads tree 2015-05-28 01:03:24 +02:00
Sam eeda367e70 FIX: should be able to serve optimized image from local if its ... local... 2015-05-26 12:32:52 +10:00
Régis Hanol bb0c2813ac FEATURE: generate (avatar) thumbnails in a background task
FIX: keep the "uploading..." indicator until the server replies via the MessageBus
FIX: text was disapearing when uploading an avatar

PERF: always use a region for S3 (defaults to 'us-east-1')
FEATURE: ApplyCDN middleware when using S3
FIX: use the same pattern to store files on S3 and locally
PERF: keep a local cache of uploads when generating thumbnails
FEATURE: migrate_to_s3 rake task
2015-05-25 17:59:00 +02:00
Régis Hanol 6ae9bcab56 add DistributedMutex around uploads/optimized_images creation 2015-05-12 16:45:33 +02:00
Régis Hanol d845dd2225 FIX: actually optimize the image! 2015-04-03 11:22:48 +02:00
Régis Hanol a87083fa76 FIX: use 'resize' option instead of 'thumbnail' when downsizing emojis 2015-03-26 18:16:15 +01:00
Régis Hanol d5828d3743 FIX: don't use 'convert' to optimize GIF + refactor 2015-02-25 15:08:33 +01:00
Régis Hanol 92e6446f0f FEATURE: new site setting 2015-02-21 18:37:37 +01:00
Régis Hanol 82157418eb FIX: we only want to downsize emojis 2015-02-20 17:24:37 +01:00
Régis Hanol e0703dbbc7 FIX: broken gravatar link when using S3
Don't break the optimized image workflow when there was an issue downloading a copy of the original image
2015-02-09 17:00:58 +01:00
Régis Hanol 0e5c9b2590 small upload code refactor 2015-02-03 18:44:18 +01:00
Régis Hanol c5a7bce557 FIX: only create animated thumbnails for GIFs 2014-12-22 12:56:19 +01:00
Régis Hanol bf666f8553 FEATURE: allow animated thumbnails 2014-11-13 23:30:34 +01:00
Régis Hanol 862c8a19a3 FEATURE: use img's title attribute in overlay information when provided 2014-11-03 22:03:06 +01:00