Commit Graph

259 Commits

Author SHA1 Message Date
Vinoth Kannan
59be289084 FIX: Do not add lightbox to onebox images (#6479) 2018-10-11 08:57:21 +11:00
Vinoth Kannan
4000dddd32
Merge pull request #6458 from vinothkannans/fix-giphy
FIX: Display large/broken image placeholders for image oneboxes
2018-10-07 18:08:54 +05:30
Vinoth Kannan
c499872597 FIX: Display large/broken image placeholders for image oneboxes 2018-10-07 17:42:41 +05:30
Sam
eba3117e08 Missed one spot where url needed cooking 2018-10-03 15:06:37 +10:00
Sam
ad0e768742 FEATURE: add support for responsive images in posts
When creating lightboxes we will attempt to create 1.5x and 2x thumbnails
for retina screens, this can be controlled with a new hidden site setting
called responsice_post_image_sizes, if you wish to create 3x images run

SiteSetting.responsive_post_image_sizes = "1|1.5|2|3"


The default should be good for most of the setups as it balances filesize
with quality. 3x thumbs can get big.
2018-10-03 13:44:53 +10:00
Guo Xiang Tan
d4b05d7bc5 Always link post to uploads in post process.
The operation is cheap anyway so no point skipping.
2018-09-06 14:08:03 +08:00
Guo Xiang Tan
434035f167 FIX: Link post to uploads in PostCreator.
* This ensures that uploads are linked to their post on creation
  instead of a background job which may be delayed if Sidekiq
  is facing difficulties.
2018-09-06 11:18:11 +08:00
Sam
9ab1fb7dfc FEATURE: correctly store width and height on uploads
Previously we used width and height for thumbnails, new code ensures

1. We auto correct width and height
2. We added extra columns for thumbnail_width and height, this is determined
 by actual upload and no longer passed in as a side effect
3. Optimized Image now stores filesize which can be used for analysis, decisions

Also

- fixes Android image manifest as a side effect
- fixes issue where a thumbnail generated that is smaller than the upload is no longer used
2018-08-28 12:59:22 +10:00
Régis Hanol
de92913bf4 FIX: store the topic links using the cooked upload url 2018-08-14 12:23:32 +02:00
Vinoth Kannan
6aee22b88f FIX: Onebox images are not downloaded locally without css class 2018-08-01 02:51:02 +05:30
Guo Xiang Tan
806f0ca19d FIX: URL with params for svg images should not be light boxed. 2018-06-20 10:47:14 +08:00
Sam
5f64fd0a21 DEV: remove exec_sql and replace with mini_sql
Introduce new patterns for direct sql that are safe and fast.

MiniSql is not prone to memory bloat that can happen with direct PG usage.
It also has an extremely fast materializer and very a convenient API

- DB.exec(sql, *params) => runs sql returns row count
- DB.query(sql, *params) => runs sql returns usable objects (not a hash)
- DB.query_hash(sql, *params) => runs sql returns an array of hashes
- DB.query_single(sql, *params) => runs sql and returns a flat one dimensional array
- DB.build(sql) => returns a sql builder

See more at: https://github.com/discourse/mini_sql
2018-06-19 16:13:36 +10:00
Guo Xiang Tan
c18b86d9b2 UX: Don't add light box for SVG images. 2018-06-18 17:11:06 +08:00
Régis Hanol
dc61eaad37 FEATURE: new 'min ratio to crop' site setting 2018-06-05 17:13:00 +02:00
Régis Hanol
c91071bb2a
FIX: don't 💥 when 'FastImage.size' has trouble with SSL 2018-05-26 00:55:19 +02:00
Arpit Jalan
b75b6de982 FIX: respect nofollow settings for onebox links 2018-03-26 18:21:16 +05:30
Arpit Jalan
17584bca5e UX: wrap full-size Twitter onebox images in aspect-ratio 2018-03-23 18:25:04 +05:30
Arpit Jalan
33c1aeb2ac UX: wrap instagram images with aspect ratio 2018-03-22 21:35:10 +05:30
Robin Ward
31a0c4a9be FEATURE: Add quote-modified class if a quote has been modified 2018-03-13 13:41:06 -04:00
Sam
f028ffaf29 SECURITY: correct local onebox category checks
Also removes ugly "source_topic_id" from cooked posts

Patch was authored by @zogstrip

Signed-off-by: Sam <sam.saffron@gmail.com>
2018-02-14 10:40:46 +11:00
Régis Hanol
7d2283167a UX: only crops images taller than 18:9 instead of 16:9 2018-01-31 22:31:16 +01:00
Arpit Jalan
7fea15ca4d FIX: rescue login required / broken images 2018-01-11 22:18:56 +05:30
Sam
b3b55e18d1 UX: stop warping tiny onebox images 2017-11-28 12:32:35 +11:00
Vinoth Kannan
1f3e9a4350 FIX: Should skip the loop if the image src is blank 2017-11-27 13:41:28 +05:30
Régis Hanol
678e28794a FIX: properly handle too large & broken images in posts 2017-11-16 15:45:07 +01:00
Vinoth Kanan
5c11104f9f FIX: Duplicate a tag if image url is same to href 2017-11-15 17:36:48 +05:30
Vinoth Kannan
7b494a65c9 NEW: large image placeholder added in cooked html (#5291) 2017-11-15 11:30:47 +01:00
Régis Hanol
23baaa5dcc FIX: don't crop iPhone X screenshots 2017-11-14 20:37:27 +01:00
Sam
ed0751f288 always double check there is a class first 2017-11-13 16:06:18 +11:00
Sam
3ac7d041ae UX: generic onebox treats all square images as avatars and renders them smaller 2017-11-13 11:21:19 +11:00
Sam
fc7dca58fe UX: oneboxes with avatars now display consistently
Onebox avatar size is reduced to 60px

Also fixes regression with some oneboxes not cooking after post
2017-11-08 11:50:01 +11:00
Arpit Jalan
2792c3c80e fix typo 2017-11-01 15:51:17 +05:30
Sam
f5cc28d740 UX: correct regression with twitter onebox 2017-11-01 16:42:56 +11:00
Sam
9197feefb8 UX: onebox images no longer cause jiggle
This stops pages from "jiggling" while oneboxes download.

see: http://cssmojo.com/aspect-ratio-using-custom-properties-and-calc/
2017-10-31 13:50:58 +11:00
Régis Hanol
17e5fb0dc0 fix the build 2017-10-23 19:09:38 +02:00
Régis Hanol
80ad32094d Small re-organization of CookedPostProcessor workflow
- only 'limit_size!' of oneboxed images once
- update post image at the end
- move 'enforce_nofollow' in its own method
2017-10-23 18:15:51 +02:00
Régis Hanol
04ae79896c Exit early when the 'img is already inside an 'a' tag 2017-10-23 17:43:53 +02:00
Gerhard Schlager
4205c1ad2b FIX: postprocessing ignored cook method 2017-10-20 10:26:45 +02:00
Régis Hanol
cbdfc85466 FIX: images aren't lightboxed anymore (partially reverts 646c6eb7cd) 2017-10-18 23:54:36 +02:00
Régis Hanol
65dc47adb4 FIX: prevent infinite 'pull_hotlinked_images' jobs when a oneboxed image has a different scheme 2017-10-18 01:50:23 +02:00
Sam Saffron
646c6eb7cd FEATURE: add :before_post_process_cooked hook
Also reduce amount of image downloading
2017-10-17 16:22:54 +11:00
Sam
70bb2aa426 FEATURE: allow specifying s3 config via globals
This refactors handling of s3 so it can be specified via GlobalSetting

This means that in a multisite environment you can configure s3 uploads
without actual sites knowing credentials in s3

It is a critical setting for situations where assets are mirrored to s3.
2017-10-06 16:20:01 +11:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Neil Lalonde
4a5907b116 Merge branch 'master' into search_posts_with_images 2017-07-31 10:44:41 -04:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Neil Lalonde
ea0e90b2b0 Merge branch 'master' into search_posts_with_images 2017-07-26 10:15:55 -04:00
Sam
a5295591b8 FEATURE: post_process_cooked event 2017-06-23 14:35:46 -04:00
Jakub Macina
bf002e0873 Add extraction of image_url for oneboxed images. Fix search by images filter name. 2017-06-19 15:18:02 +02:00
Guo Xiang Tan
d4d0aa8ca7 Minor fixes for https://github.com/discourse/discourse/pull/4845. 2017-06-07 10:03:19 +09:00
Vinoth Kannan
209383faab FEATURE: pull onebox images 2017-06-06 18:51:58 +05:30
Robin Ward
009e120e13 FIX: Don't raise an error when the img attribute cannot be found 2017-05-08 15:35:31 -04:00
Régis Hanol
02bb7beaaf FIX: don't put attachments on the CDN when 'prevent anons from downloading files' is enabled 2017-02-07 18:06:44 +01:00
Arpit Jalan
19f7beaa2c FIX: topic links were getting dropped when post is rebaked 2017-01-30 14:55:53 +05:30
Régis Hanol
a655e4b092 ensure we allow self oneboxing of login required sites 2016-11-03 22:48:32 +01:00
Arpit Jalan
382803cb05 FEATURE: include post image in OpenGraph image tag 2016-10-31 15:11:33 +05:30
Guo Xiang Tan
7db33cc512 FIX: Videos and audio files were not associated to the post. 2016-10-18 16:13:39 +08:00
Robin Ward
aef954784a FIX: nofollow was being added during post processing when it shouldn't 2016-08-12 15:35:13 -04:00
Guo Xiang Tan
11afb20772 SECURITY: Escape HTML in filename. 2016-08-11 11:27:12 +08:00
Régis Hanol
e55e2aff94 FIX: FirstReplyByEmail badge wasn't granted
DEPRECATED: PostProcess badge trigger
2016-08-10 19:24:01 +02:00
Robin Ward
a546395397 REFACTOR: Migrate markdown functionality in ES6 2016-07-11 12:57:05 -04:00
Arpit Jalan
2facb6190f FEATURE: new site setting download_remote_images_max_days_old 2016-07-06 19:33:51 +05:30
Régis Hanol
da8163eb29 FIX: 'cdn_url' not 'cnd_url' 2016-06-30 17:15:56 +02:00
Régis Hanol
5169bcdb6e FIX: httpshttps ultra secure URLs 2016-06-30 16:55:01 +02:00
Régis Hanol
f3905fd99a FIX: S3 CDN wasn't applied to lightboxed images 2016-06-27 22:08:49 +02:00
Régis Hanol
ebd4b45771 FIX: use 16:9 ratio to detect whether to crop a thumbnail or not 2016-05-26 19:02:31 +02:00
Régis Hanol
32d253d484 remove 'crop_tall_images' site setting but keep the behavior 2016-05-23 16:42:19 +02:00
Régis Hanol
667dd54a23 FEATURE: new 'crop_tall_images' site setting 2016-05-23 16:18:30 +02:00
Robin Ward
b0803f7035
FIX: New badges were missing post link 2016-04-13 16:38:24 -04:00
Robin Ward
0396b14b70
FEATURE: New "First Onebox" badge 2016-04-12 15:31:14 -04:00
Sam
22b2f5285c FIX: extract links in post processor
when oneboxes are not cached or are refreshed they can introduce new
links, these links must be extracted otherwise you can not follow them
2016-04-12 12:28:18 +10:00
Robin Ward
5059ee04b9 Remove UserFirst table and grant Emoji badge directly 2016-04-07 12:31:41 -04:00
Robin Ward
5866f0df18 Remove UserFirst for mention since it can be retrieved elsewhere 2016-04-06 14:01:37 -04:00
Robin Ward
189d70661e FIX: Don't count emojis within quotes 2016-04-06 12:02:35 -04:00
Robin Ward
64a1a44c4b FIX: Don't create user first records on private posts 2016-04-05 16:13:10 -04:00
Robin Ward
c30d327b77 FEATURE: Two new badges - First Emoji and First Mention 2016-04-05 15:17:41 -04:00
Guo Xiang Tan
322ee3e17c Fix the build. 2016-03-08 11:38:26 +08:00
Guo Xiang Tan
00078a438b FIX: FastImage#size returns nil if it can't fetch the image size. 2016-03-08 11:29:18 +08:00
Régis Hanol
dcd0270d52 FIX: don't use the CDN for attachments when login is required 2016-01-06 21:54:01 +01:00
Arpit Jalan
f38abbe279 FIX: onebox links should respect nofollow settings 2015-12-04 01:59:12 +05:30
Robin Ward
d65ec1af2e Rename ninja_edit_window to editing_grace_period :'( 2015-11-24 14:28:42 -05:00
Régis Hanol
37c5909a31 FIX: use the first image in the first post in the topic as opengraph image
FEATURE: new 'default_opengraph_image_url' setting
2015-10-15 11:00:47 +02:00
Régis Hanol
54d6d24cbf FIX: timing issue with edits and cook post processing 2015-09-29 18:51:26 +02:00
Sam
57870b970d correct hack and move to oneboxer 2015-09-25 20:14:53 +10:00
Sam
fc2d61136d FEATURE: add context for cross topic links 2015-09-25 14:52:43 +10:00
kerryliu
c85835afc3 FIX: rescale image during cooked_post_processor when only img height or width is specified 2015-08-29 15:23:25 -07:00
Neil Lalonde
7581a7d869 move notification about low disk space into its own method 2015-08-14 17:46:15 -04:00
Sam
23b8a408f7 FIX: serialize post processing
This avoids all sorts of nasty race conditions in job schedular
2015-08-14 13:05:13 +10:00
Régis Hanol
3f71fa15c9 reduce log level when we can't reach an image while cooking a post 2015-08-12 16:10:42 +02:00
Régis Hanol
485d9a5a52 Log an error when we can't reach an image to get its dimensions 2015-08-07 19:31:15 +02:00
Régis Hanol
82d743a052 FIX: don't use emojis as topic image 2015-08-05 12:57:31 +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
6c7e737294 FIX: truncate topic image_url 2015-06-10 18:53:14 +02:00
Régis Hanol
a737090442 - FEATURE: revamped poll plugin
- add User.staff scope
- inject MessageBus into Ember views (so it can be used by the poll plugin)
- REFACTOR: use more accurate is_first_post? method instead of post_number == 1
- FEATURE: add support for JSON-typed custom fields
- FEATURE: allow plugins to add validation
- FEATURE: add post_custom_fields to PostSerializer
- FEATURE: allow plugins to whitelist post_custom_fields
- FIX: don't bump when post did not save successfully
- FEATURE: polls are supported in any post
- FEATURE: allow for multiple polls in the same post
- FEATURE: multiple choice polls
- FEATURE: rating polls
- FEATURE: new dialect allowing users to preview polls in the composer
2015-04-23 19:33:29 +02:00
Régis Hanol
5d74cadf2f FIX: picture would be hidden when [details] block was closed in the composer 2015-03-16 18:57:15 +01:00
Sam
497042ddf2 FIX: don't restrict to local filesystem for df check
FIX: check correct directory when looking at backup limits
2015-01-27 08:25:57 +11:00
Sam
7d07ad4aa4 FIX: check free space in uploads directory, not global system 2015-01-11 06:43:06 +11: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
31e9cafe0e FEATURE: use original filename when clicking the download link in the lightbox 2014-10-15 19:20:04 +02:00
Régis Hanol
5681338b08 FIX: log a staff action + send a private message when disabling the 'download_remote_images_to_local' site setting 2014-09-23 19:11:43 +02:00
Régis Hanol
d1608bdfe9 FIX: better error handling in vBulletin importer 2014-09-08 11:02:54 +02:00
Akshay
3fd784b513 removed useless assignments at some places 2014-08-19 18:10:23 +05:30
Régis Hanol
8bde019910 FEATURE: grab oneboxed image dimensions to prevent 'jiggles' while loading 2014-07-21 15:59:34 +02:00
Régis Hanol
c7330ed73f BUGFIX: errors when post-processing 'data images' 2014-07-18 17:54:18 +02:00
Sam
c47a70e390 FIX: extra safety 2014-07-18 10:36:17 +10:00
Régis Hanol
1566693b6e BUGFIX: do not lightbox oneboxed images 2014-05-12 12:07:05 +02:00
Régis Hanol
b61abe3107 FEATURE: warn the admin whenever we disable the download_remote_images_to_local site setting 2014-04-23 12:43:10 +02:00
Robin Ward
e453bfa073 Work in progress: Swap out onebox code for onebox gem 2014-01-29 14:14:07 -05:00
Régis Hanol
c6fb60e0a0 FIX: S3 upload when using dots in bucket name 2013-12-16 11:44:59 +01:00
Régis Hanol
06dd7ffe3c better revision history 2013-12-12 03:41:34 +01:00
Régis Hanol
418856a789 make sure assets always use schemaless absolute uris 2013-12-06 11:16:13 +01:00
Régis Hanol
5150376e12 add wrapper class for lightboxes 2013-12-02 10:06:48 +01:00
Régis Hanol
298b54c0e7 add download link in lightbox 2013-11-29 20:03:39 +01:00
Régis Hanol
6b6c3d05dd FIX stretched thumbnails 2013-11-25 18:36:13 +01:00
Régis Hanol
f65cde3cda do not bump posts when rebaking 2013-11-22 01:52:26 +01:00
Régis Hanol
31fd5b85bc FIX markdown hotlinked images were not properly pulled 2013-11-20 13:10:08 +01:00
Régis Hanol
8a83f1a88f add disk space usage failsafe 2013-11-15 16:48:38 +01:00
Régis Hanol
16267e4887 add download_remote_images_to_local site setting 2013-11-15 15:22:18 +01:00
Régis Hanol
4863c4517a use absolute url for assets too 2013-11-06 16:59:11 +01:00
Régis Hanol
3992aa971d ninja_edit_window is is seconds, not minutes 2013-11-06 11:08:57 +01:00
Régis Hanol
37fd7ab574 pull hotlinked images 2013-11-05 19:07:29 +01:00
Régis Hanol
4536b5fe04 added a job to clean up orphan uploads 2013-10-15 11:15:48 +02:00
Régis Hanol
cd4cda5b4c allow users to specify thumbnail size 2013-09-27 10:57:31 +02:00
Régis Hanol
32f717420d add max_image_height site setting 2013-08-26 00:24:24 +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
Sam
0a7bbb08e1 fix broken build 2013-07-24 17:24:55 +10:00
Régis Hanol
dbf6fb0232 change the pipe into a bullet in the lightbox overlay 2013-07-22 22:41:08 +02:00
Régis Hanol
2986798ba7 add newuser-max-attachments setting 2013-07-22 02:39:17 +02:00
Régis Hanol
7ae2fe304d renamed s3 to s3_store 2013-07-17 00:27:52 +02:00
Régis Hanol
3397c2235f display the size of the attachment in the preview
instead of adding it during post processing
2013-07-14 12:28:24 +02:00
Régis Hanol
da614597fe post process attachments 2013-07-10 22:59:53 +02:00
Régis Hanol
ac7253a938 refactor CookedPostProcessor & specs 2013-07-08 01:39:08 +02:00
Régis Hanol
6251935b1e removed auto_link_images_wider_than setting 2013-07-06 22:19:16 +02:00
Régis Hanol
5a56af03bc FIX: can no longer paste image in Chrome post editor 2013-07-04 00:39:23 +02:00
Régis Hanol
72745d257d provide a way to give a default filename to pasted images in the lightbox overlay 2013-06-26 21:54:08 +02:00
Régis Hanol
d3eae56e71 soften the lightbox overlay 2013-06-26 02:44:20 +02:00
Régis Hanol
da52ac88b0 do not throw exception when parsing a bad URI 2013-06-24 21:38:00 +02:00
Sam
22d6f6784c Merge pull request #1075 from ZogStriP/fix-lightboxing-when-using-s3
FIX: lightbox wasn't working when using s3 upload
2013-06-23 22:11:45 -07:00
Régis Hanol
361062d53e do not lightbox oneboxed images 2013-06-24 02:10:21 +02:00
Régis Hanol
08aa23f0ca FIX: lightbox wasn't working when using s3 upload 2013-06-22 13:38:42 +02:00
Robin Ward
456cff17f8 FIX: If the image has no thumbnail, don't update the src 2013-06-21 14:32:42 -04:00
Régis Hanol
787555431c add lightbox overlay 2013-06-21 18:30:57 +02:00
Régis Hanol
7bdc616040 keep uploads reverse index up to date 2013-06-17 22:46:48 +02:00
Régis Hanol
cc9e0ec80a create thumbnails when needed 2013-06-17 02:49:34 +02:00
Régis Hanol
2c3f757951 moved has_been_uploaded and uploaded_regex to the Upload model 2013-06-17 02:49:34 +02:00
Régis Hanol
c11f4456ae cleaned up CookedPostProcessor and improved specs 2013-06-17 02:49:34 +02:00
Régis Hanol
8a2d635e62 removed imgur support 2013-06-11 21:51:41 +02:00
Michael Kessler
d2e45cb8fd Don't append the base url to absolute image urls without protocol. 2013-05-30 17:17:07 +02:00
Neil Lalonde
631ed3df58 Checking size of some gifs throws a Zlib::BufError. Tolerate it until we can figure out why. 2013-04-23 14:08:05 -04:00
Sam
1bd3744676 disable image optimization for now 2013-04-19 09:50:23 +10:00
Régis Hanol
4a94f12a33 FIX: optimized images url when using a CDN 2013-04-19 00:19:08 +02:00