Custom modifiers
The predefined modifiers are not enough for your use case? No problem! You can easily write your own.
Implement your own image modifier by extending the Abstract
class and implementing the Modifier
method.
Classes/Image/CustomModifier.php
<?php
namespace Vendor\YourExt\Image;
use Intervention\Image\Geometry\Factories\RectangleFactory;
use Intervention\Image\Interfaces\ImageInterface;
class CustomModifier extends AbstractModifier implements ModifierInterface {
public function modify(ImageInterface &$image): void
{
// Modify the image
}
public function getRequiredConfigurationKeys(): array
{
// Return the required configuration keys
}
}
Copied!
See the Intervention Image documentation for more information about image manipulation.
Note
Having fun with colorful favicons? Use the Color
function as color entry in your modifier configuration to generate a color based on a string (default is the
$GLOBALS
).