[Embed] Revert defaults and fix Readme example

This commit is contained in:
Diogo Peralta Cordeiro 2021-02-21 20:20:48 +00:00
parent bcae2f26b5
commit a500277dca
3 changed files with 10 additions and 10 deletions

View File

@ -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];
}
/**

View File

@ -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 = [];

View File

@ -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'