From 844ecbf71ea42421b301b9b2d189fe43f6db9432 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Sun, 21 Feb 2021 20:20:48 +0000 Subject: [PATCH] [Embed] Revert defaults and fix Readme example --- lib/media/imagefile.php | 2 +- plugins/Embed/EmbedPlugin.php | 6 +++--- plugins/Embed/README.md | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/media/imagefile.php b/lib/media/imagefile.php index 7b334f7c70..4b1d3f9821 100644 --- a/lib/media/imagefile.php +++ b/lib/media/imagefile.php @@ -507,7 +507,7 @@ class ImageFile extends MediaFile return [(int)$rw, (int)$rh, (int)$cx, (int)$cy, is_null($cw) ? $width : (int)$cw, - is_null($ch) ? $height : (int)$ch,]; + is_null($ch) ? $height : (int)$ch]; } /** diff --git a/plugins/Embed/EmbedPlugin.php b/plugins/Embed/EmbedPlugin.php index 4aab42c944..e40b41d611 100644 --- a/plugins/Embed/EmbedPlugin.php +++ b/plugins/Embed/EmbedPlugin.php @@ -55,9 +55,9 @@ class EmbedPlugin extends Plugin public $append_whitelist = []; // fill this array as domain_whitelist to add more trusted sources public $check_whitelist = false; // security/abuse precaution - public $thumbnail_width = null; - public $thumbnail_height = null; - public $crop = null; + public $thumbnail_width = 128; + public $thumbnail_height = 128; + public $crop = true; public $max_size = null; protected $imgData = []; diff --git a/plugins/Embed/README.md b/plugins/Embed/README.md index 30c7f5f27f..705f519bdf 100644 --- a/plugins/Embed/README.md +++ b/plugins/Embed/README.md @@ -10,24 +10,24 @@ Settings ======== * `domain_whitelist`: Array of regular expressions. Always escape your dots and end your strings. * `check_whitelist`: Whether to check the domain_whitelist. -* `thumbnail_width`: Maximum width of the thumbnail in pixels. Defaults to global `[thumbnail][width]`. -* `thumbnail_height`: Maximum height of the thumbnail in pixels. Defaults to global `[thumbnail][height]`. -* `crop`: Crop to the size (not preserving aspect ratio). Defaults to global `[thumbnail][crop]`. +* `thumbnail_width`: Maximum width of the thumbnail in pixels. Defaults to 128. Setting as `null` makes it use global `[thumbnail][width]`. +* `thumbnail_height`: Maximum height of the thumbnail in pixels. Defaults to 128. Setting as `null` makes it use global `[thumbnail][height]`. +* `crop`: Crop to the size (not preserving aspect ratio). Defaults to true. Setting as `null` makes it use global `[thumbnail][crop]`. * `max_size`: Max media size. Anything bigger than this is rejected. Defaults to global `[attachments][file_quota]`. Relevant GNU social global settings =================================== -* `[attachments][show_html]`: Whether to show HTML oEmbed data. +* `[attachments][show_html]`: Whether to show HTML oEmbed data. Defaults to false. Example ======= ``` -$config['thumbnail']['width'] = 42; -$config['thumbnail']['height'] = 42; $config['attachments']['show_html'] = true; addPlugin('Embed', [ + 'thumbnail_width' => 42, + 'thumbnail_height' => 42, 'domain_whitelist' => [ '^i\d*\.ytimg\.com$' => 'YouTube', '^i\d*\.vimeocdn\.com$' => 'Vimeo'