Commit Graph

125 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
Régis Hanol
2c7b47fc40 fix the build 2014-11-03 20:42:13 +01:00
Régis Hanol
bdb78ce76a FEATURE: consider SVG as an image when authorized 2014-11-03 19:54:10 +01:00
Régis Hanol
bfdbb70b3b FIX: automatic backup uploads to S3 when using a region 2014-09-24 22:52:09 +02:00
Régis Hanol
3d94c671db BUGFIX: explicit code is often better... 2014-07-04 16:05:50 +02:00
Régis Hanol
609d1e05cd FEATURE: optimize the hell out of letter avatars 2014-07-04 13:27:17 +02:00
Régis Hanol
2f23ee1830 BUGFIX: keep transparent background in avatars 2014-06-11 16:01:01 +02:00
Régis Hanol
16b1379b01 BUGFIX: uploaded avatar aren't cropped 2014-06-04 18:54:08 +02:00
Sam
fa6f22dd39 Move letter avatars out of upload system
FIX: S3 issues around system avatars
FIX: reduced backup file size
2014-05-30 14:45:55 +10:00
Sam Saffron
4b611f87e9 use bicubic so we support earlier image magicks like the one in docker
TODO upgrade docker base image to latest image magick
2014-05-27 15:38:11 +10:00
Sam
4ccf07be8c Improve resize logic so images end up sharper 2014-05-27 09:48:13 +10:00
Louis Rose
1574485443 Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
2014-05-06 14:41:59 +01:00
Régis Hanol
6373de550f update annotations 2014-04-08 17:35:44 +02:00
Régis Hanol
37fd7ab574 pull hotlinked images 2013-11-05 19:07:29 +01:00
Régis Hanol
cd4cda5b4c allow users to specify thumbnail size 2013-09-27 10:57:31 +02:00
Régis Hanol
43a8bff652 add a site setting for allowing animated avatars 2013-08-23 18:55:02 +02:00
Régis Hanol
9a7df140b7 updated model annotations 2013-08-13 22:09:27 +02:00
Régis Hanol
ed9417fa3b enable thumbnailing on S3
- added url to optimized image model
- refactored s3_store & local_store
2013-07-31 23:26:34 +02:00
Régis Hanol
ac41e94619 refactor optimized_image a bit 2013-07-10 22:59:54 +02:00
Régis Hanol
ac7253a938 refactor CookedPostProcessor & specs 2013-07-08 01:39:08 +02:00
Régis Hanol
8a751e6e44 make sure we also delete optimized images 2013-06-21 09:34:02 +02:00
Régis Hanol
af45b5a11e proper column naming
silly schemaless database habits are hard to kill
2013-06-17 04:02:17 +02:00
Régis Hanol
454636abf1 annotate models 2013-06-17 02:49:34 +02:00
Régis Hanol
510bac4b27 refactored a bit & tested thumbnails creation 2013-06-17 02:49:34 +02:00
Régis Hanol
cc9e0ec80a create thumbnails when needed 2013-06-17 02:49:34 +02:00
Régis Hanol
5de03814fb created optimized_image model 2013-06-17 02:49:34 +02:00