[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.
This commit is contained in:
@@ -157,7 +157,7 @@ class StoreRemoteMedia extends Plugin
|
||||
// Create an attachment for this
|
||||
$temp_file = new TemporaryFile();
|
||||
$temp_file->write($media);
|
||||
$attachment = GSFile::sanitizeAndStoreFileAsAttachment($temp_file);
|
||||
$attachment = GSFile::storeFileAsAttachment($temp_file);
|
||||
|
||||
// Relate the link with the attachment
|
||||
DB::persist(AttachmentToLink::create([
|
||||
@@ -177,8 +177,7 @@ class StoreRemoteMedia extends Plugin
|
||||
if (!$this->getStoreOriginal()) {
|
||||
$thumbnail = AttachmentThumbnail::getOrCreate(
|
||||
attachment: $attachment,
|
||||
width: $this->getThumbnailWidth(),
|
||||
height: $this->getThumbnailHeight(),
|
||||
size: 'small',
|
||||
crop: $this->getSmartCrop()
|
||||
);
|
||||
$attachment->deleteStorage();
|
||||
|
Reference in New Issue
Block a user