[MEDIA] Allow thumbnail only entries

This commit is contained in:
2021-02-21 10:35:02 +00:00
parent 4deaaa8dbe
commit 422b82d3be
7 changed files with 69 additions and 39 deletions

View File

@@ -57,7 +57,7 @@ class EmbedPlugin extends Plugin
public $thumbnail_width = null;
public $thumbnail_height = null;
public $crop = true;
public $crop = null;
public $max_size = null;
protected $imgData = [];
@@ -77,6 +77,7 @@ class EmbedPlugin extends Plugin
$this->thumbnail_width = $this->thumbnail_width ?? common_config('thumbnail', 'width');
$this->thumbnail_height = $this->thumbnail_height ?? common_config('thumbnail', 'height');
$this->max_size = $this->max_size ?? common_config('attachments', 'file_quota');
$this->crop = $this->crop ?? common_config('thumbnail', 'crop');
}
/**
@@ -617,7 +618,7 @@ class EmbedPlugin extends Plugin
);
}
$url = $thumbnail->getUrl();
$url = $thumbnail->url; // Important not to use the getter here.
if (substr($url, 0, 7) == 'file://') {
$filename = substr($url, 7);
@@ -675,7 +676,7 @@ class EmbedPlugin extends Plugin
}
try {
// Update our database for the file record
// Update our database for the thumbnail record
$orig = clone($thumbnail);
$thumbnail->filename = $filename;
$thumbnail->width = $width;

View File

@@ -12,7 +12,7 @@ Settings
* `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 thumbnail size and don't preserve the original file. Defaults to true.
* `crop`: Crop to the size (not preserving aspect ratio). Defaults to 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