gnu-social/plugins/Embed
Diogo Peralta Cordeiro 05f16a3084
[ENTITY][AttachmentThumbnail] Now thumbnails are always only available in three sizes: small, medium, big
Commit jointly produced with eli (Eliseu Amaro)

Breaking change: Entity changed to only store the tinyint referring to the size stored

With this, the logic was simplified and now it's not possible to make an
instance produce unnecessary thumbs. The aspect ratio is preserved and
thus the thumbs will always look nice. New configuration was added to
maintain flexibility.
2021-09-22 15:13:46 +01:00
..
Controller [TOOLS] Fix all level 0 errors found by PHPStan and move constant definition to bootstrap file 2021-09-14 13:13:42 +01:00
Entity [TOOLS][PHPStan] Raise PHPStan level to 3 and fix new errors 2021-09-14 13:13:45 +01:00
Test [TOOLS] Fix all level 0 errors found by PHPStan and move constant definition to bootstrap file 2021-09-14 13:13:42 +01:00
locale [Emebed] Add Embed plugin and initial cleanup 2021-09-14 13:12:24 +01:00
templates/embed [Embed] Add UI element and fix some bugs 2021-09-14 13:13:27 +01:00
Embed.php [ENTITY][AttachmentThumbnail] Now thumbnails are always only available in three sizes: small, medium, big 2021-09-22 15:13:46 +01:00
README.md [Embed] Revert defaults and fix Readme example 2021-02-21 20:20:48 +00:00
composer.json [Embed] Move composer dependency embed/embed from core to plugin 2021-09-14 13:13:31 +01:00

README.md

The Embed plugin for using and representing both Open Graph and oEmbed data.

See: https://ogp.me/ and https://www.oembed.com/

Installation

This plugin is enabled by default.

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 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. Defaults to false.

Example

$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'
    ],
    'check_whitelist' => true
    ]
);