-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* `hasSettings` -> `hasCpSettings` for Craft 3 beta 8 compatibility * Added Craft 3 beta 8 compatible settings * Modified config service calls for Craft 3 beta 8
- Loading branch information
Showing
7 changed files
with
127 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* ImageOptim plugin for Craft CMS 3.x | ||
* | ||
* Automatically optimize images after they've been transformed | ||
* | ||
* @link https://nystudio107.com | ||
* @copyright Copyright (c) 2017 nystudio107 | ||
*/ | ||
|
||
namespace nystudio107\imageoptim\models; | ||
|
||
use craft\base\Model; | ||
|
||
/** | ||
* ImageOptim Settings model | ||
* | ||
* @author nystudio107 | ||
* @package ImageOptim | ||
* @since 1.0.0 | ||
*/ | ||
class Settings extends Model | ||
{ | ||
// Public Properties | ||
// ========================================================================= | ||
|
||
/** | ||
* Active image processors | ||
* | ||
* @var array | ||
*/ | ||
public $activeImageProcessors = [ | ||
'jpg' => [ | ||
'jpegoptim', | ||
], | ||
'png' => [ | ||
'optipng', | ||
], | ||
'svg' => [ | ||
'svgo', | ||
], | ||
'gif' => [ | ||
'gifsicle', | ||
], | ||
]; | ||
|
||
/** | ||
* Preset image processors | ||
* | ||
* @var array | ||
*/ | ||
public $imageProcessors = [ | ||
// jpeg optimizers | ||
'jpegoptim' => [ | ||
'commandPath' => '/usr/bin/jpegoptim', | ||
'commandOptions' => '-s', | ||
], | ||
'mozjpeg' => [ | ||
'commandPath' => '/usr/bin/mozjpeg', | ||
'commandOptions' => '-optimize -copy none', | ||
], | ||
'jpegtran' => [ | ||
'commandPath' => '/usr/bin/jpegtran', | ||
'commandOptions' => '-optimize -copy none', | ||
], | ||
// png optimizers | ||
'optipng' => [ | ||
'commandPath' => '/usr/bin/optipng', | ||
'commandOptions' => '-o7 -strip all', | ||
], | ||
'pngcrush' => [ | ||
'commandPath' => '/usr/bin/pngcrush', | ||
'commandOptions' => '-brute -ow', | ||
], | ||
'pngquant' => [ | ||
'commandPath' => '/usr/bin/pngquant', | ||
'commandOptions' => '--strip --skip-if-larger', | ||
], | ||
// svg optimizers | ||
'svgo' => [ | ||
'commandPath' => '/usr/bin/svgo', | ||
'commandOptions' => '', | ||
], | ||
// gif optimizers | ||
'gifsicle' => [ | ||
'commandPath' => '/usr/bin/gifsicle', | ||
'commandOptions' => '-O3 -k 256', | ||
], | ||
]; | ||
|
||
// Public Methods | ||
// ========================================================================= | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
['activeImageProcessors', 'required'], | ||
['imageProcessors', 'required'], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters