1. 8.5.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface
  2. 8.0.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface
  3. 8.1.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface
  4. 8.2.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface
  5. 8.3.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface
  6. 8.4.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface
  7. 8.6.x core/modules/image/src/ImageEffectInterface.php ImageEffectInterface

Defines the interface for image effects.

Hierarchy

Expanded class hierarchy of ImageEffectInterface

All classes that implement ImageEffectInterface

See also

\Drupal\image\Annotation\ImageEffect

\Drupal\image\ImageEffectBase

\Drupal\image\ConfigurableImageEffectInterface

\Drupal\image\ConfigurableImageEffectBase

\Drupal\image\ImageEffectManager

Plugin API

1 file declares its use of ImageEffectInterface
ImageStyle.php in core/modules/image/src/Entity/ImageStyle.php

File

core/modules/image/src/ImageEffectInterface.php, line 19

Namespace

Drupal\image
View source
interface ImageEffectInterface extends PluginInspectionInterface, ConfigurablePluginInterface {

  /**
   * Applies an image effect to the image object.
   *
   * @param \Drupal\Core\Image\ImageInterface $image
   *   An image file object.
   *
   * @return bool
   *   TRUE on success. FALSE if unable to perform the image effect on the image.
   */
  public function applyEffect(ImageInterface $image);

  /**
   * Determines the dimensions of the styled image.
   *
   * @param array &$dimensions
   *   Dimensions to be modified - an array with the following keys:
   *   - width: the width in pixels, or NULL if unknown
   *   - height: the height in pixels, or NULL if unknown
   *   When either of the dimensions are NULL, the corresponding HTML attribute
   *   will be omitted when an image style using this image effect is used.
   * @param string $uri
   *   Original image file URI. It is passed in to allow an effect to
   *   optionally use this information to retrieve additional image metadata
   *   to determine dimensions of the styled image.
   *   ImageEffectInterface::transformDimensions key objective is to calculate
   *   styled image dimensions without performing actual image operations, so
   *   be aware that performing IO on the URI may lead to decrease in
   *   performance.
   */
  public function transformDimensions(array &$dimensions, $uri);

  /**
   * Returns the extension the derivative would have have after applying this
   * image effect.
   *
   * @param string $extension
   *   The file extension the derivative has before applying.
   *
   * @return string
   *   The file extension after applying.
   */
  public function getDerivativeExtension($extension);

  /**
   * Returns a render array summarizing the configuration of the image effect.
   *
   * @return array
   *   A render array.
   */
  public function getSummary();

  /**
   * Returns the image effect label.
   *
   * @return string
   *   The image effect label.
   */
  public function label();

  /**
   * Returns the unique ID representing the image effect.
   *
   * @return string
   *   The image effect ID.
   */
  public function getUuid();

  /**
   * Returns the weight of the image effect.
   *
   * @return int|string
   *   Either the integer weight of the image effect, or an empty string.
   */
  public function getWeight();

  /**
   * Sets the weight for this image effect.
   *
   * @param int $weight
   *   The weight for this image effect.
   *
   * @return $this
   */
  public function setWeight($weight);

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
ConfigurablePluginInterface::defaultConfiguration public function Gets default configuration for this plugin.
ConfigurablePluginInterface::getConfiguration public function Gets this plugin's configuration.
ConfigurablePluginInterface::setConfiguration public function Sets the configuration for this plugin instance.
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin.
ImageEffectInterface::applyEffect public function Applies an image effect to the image object.
ImageEffectInterface::getDerivativeExtension public function Returns the extension the derivative would have have after applying this image effect.
ImageEffectInterface::getSummary public function Returns a render array summarizing the configuration of the image effect.
ImageEffectInterface::getUuid public function Returns the unique ID representing the image effect.
ImageEffectInterface::getWeight public function Returns the weight of the image effect.
ImageEffectInterface::label public function Returns the image effect label.
ImageEffectInterface::setWeight public function Sets the weight for this image effect.
ImageEffectInterface::transformDimensions public function Determines the dimensions of the styled image.
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation.
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance.