⇦  Back to Image classMethod filter
public \Joomla\CMS\Image\Image
filter
(mixed $type, array $options = [])
Method to apply a filter to the image by type.  Two examples are: grayscale and sketchy.
Parameters
- string  $type  The name of the image filter to apply.
 - array  $options  An array of options for the filter.
 
Returns
Since
-
- \Joomla\CMS\Image\Filter
 - \LogicException
 
Method filter - Source code
/**
 * Method to apply a filter to the image by type.  Two examples are: grayscale and sketchy.
 *
 * @param   string  $type     The name of the image filter to apply.
 * @param   array   $options  An array of options for the filter.
 *
 * @return  Image
 *
 * @since   2.5.0
 * @see     \Joomla\CMS\Image\Filter
 * @throws  \LogicException
 */
public function filter($type, array $options = [])
{
    // Make sure the resource handle is valid.
    if (!$this->isLoaded()) {
        throw new \LogicException('No valid image was loaded.');
    }
    // Get the image filter instance.
    $filter = $this->getFilterInstance($type);
    // Execute the image filter.
    $filter->execute($options);
    return $this;
}