showpro\ImageOptimiser\Tasks\ImageOptimiserTask
Task to optimise all SilverStripe generated images
It's a hack based on a hack - https://gist.github.com/blueo/6598bc349b406cf678f9a8f009587a95
as SilverStripe doesn't have a native public way of returning Image Variants.
- Author: : Techno Joy development team (www.technojoy.co.nz)
- License: : MIT-style license http://opensource.org/licenses/MIT
Synopsis
class ImageOptimiserTask
extends BuildTask
{
- // members
- protected string $title = 'Optimise All Images';
- protected string $description = 'Optimises all previously uploaded images';
- private static string $segment = 'ImageOptimiser';
- protected bool $enabled = false;
- // methods
- public String run()
- private Array _findOrOptimiseAllImagesAndVariants()
Hierarchy
Extends
- SilverStripe\Dev\BuildTask
Members
private
- $segment
—
string
Set a custom url segment (to follow dev/tasks/)
protected
- $description
—
string
Task Description - $enabled
—
showpro\ImageOptimiser\Tasks\bool
Enable the task - $title
—
string
Task Title
Methods
private
- _findOrOptimiseAllImagesAndVariants() — Find All Images And Variants Optionally optimise
public
- run() — Implement this method in the task subclass to execute via the TaskRunner