purplespider / silverstripe-clearer-thumbnails
Makes CMS and UploadField thumbnails clearer
Installs: 1 657
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 2
Type:silverstripe-vendormodule
Requires
- silverstripe/cms: ^4 || ^5.0
This package is auto-updated.
Last update: 2024-11-19 15:36:21 UTC
README
This module fixes an issue in Silverstripe 4 which results in particularly tall or wide images having pixelated/blurry thumbnails in the CMS, particularly for UploadFields
.
Before:
After:
It also increases the size of thumbnail images to ensure they remain crips on HiDPI/Retina displays.
Installation
- Install module via composer:
composer require purplespider/silverstripe-clearer-thumbnails "1.*"
- Perform a flush:
https://www.example.com?flush=1
- For Silverstripe 4: For sites with existing assets, run the generate-cms-thumbnails task to re-generate the thumbnails for the Files tab (otherwise no thumbnails will appear).
php vendor/silverstripe/framework/cli-script.php dev/tasks/MigrateFileTask only=generate-cms-thumbnails
Silverstripe 5 doesn't provide the MigrateFileTask anymore.
What exactly does this do?
It simply overrides some settings via a config file to:
- Change
ThumbnailGenerator
$method
fromFitMax
toFill
which avoids thumbnails being generated too small and then stretched. - Doubles the
UploadField
$thumbnail_width
and$thumbnail_height
from60
to120
to ensure thumbnails are crisp on HiDPI/Retina displays. - Increases the
Image
$asset_preview_width
and$asset_preview_height
to ensure image previews in the Files area are crisp on HiDPI/Retina displays.
Notes/Tips
- On sites with lots of images, the migration task is a resource intensive process which can take a while. Use
cpulimit
to limit the effect it has on the site, e.g.cpulimit -p 1234 -l 50
- Possible issue with assets in a symlinked location not getting updated via the migration task, suggest temporarily replacing the symlink with the assets dir before running the task if you experience this.