Drupal 8  8.0.2
ResizeImageEffect Class Reference
Inheritance diagram for ResizeImageEffect:

Public Member Functions

 applyEffect (ImageInterface $image)
 
 transformDimensions (array &$dimensions, $uri)
 
 getSummary ()
 
 defaultConfiguration ()
 
 buildConfigurationForm (array $form, FormStateInterface $form_state)
 
 submitConfigurationForm (array &$form, FormStateInterface $form_state)
 
- Public Member Functions inherited from ConfigurableImageEffectBase
 validateConfigurationForm (array &$form, FormStateInterface $form_state)
 
 submitConfigurationForm (array &$form, FormStateInterface $form_state)
 
- Public Member Functions inherited from ImageEffectBase
 __construct (array $configuration, $plugin_id, $plugin_definition, LoggerInterface $logger)
 
 transformDimensions (array &$dimensions, $uri)
 
 getDerivativeExtension ($extension)
 
 getSummary ()
 
 label ()
 
 getUuid ()
 
 setWeight ($weight)
 
 getWeight ()
 
 getConfiguration ()
 
 setConfiguration (array $configuration)
 
 defaultConfiguration ()
 
 calculateDependencies ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ImageEffectBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
- Protected Attributes inherited from ImageEffectBase
 $uuid
 
 $weight = ''
 
 $logger
 

Detailed Description

Resizes an image resource.

( id = "image_resize", label = ("Resize"), description = ("Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.") )

Member Function Documentation

applyEffect ( ImageInterface  $image)

{Applies an image effect to the image object.

Parameters
\Drupal\Core\Image\ImageInterface$imageAn image file object.
Returns
bool TRUE on success. FALSE if unable to perform the image effect on the image.
}

Implements ImageEffectInterface.

References ImageInterface\getHeight(), ImageInterface\getMimeType(), ImageInterface\getSource(), ImageInterface\getToolkitId(), ImageInterface\getWidth(), Drupal\logger(), and ImageInterface\resize().

Here is the call graph for this function:

buildConfigurationForm ( array  $form,
FormStateInterface  $form_state 
)

{Form constructor.Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and #array_parents, see .

Parameters
array$formAn associative array containing the initial structure of the plugin form.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the complete form.
Returns
array The form structure.
}

Implements PluginFormInterface.

References t().

Here is the call graph for this function:

defaultConfiguration ( )

{Gets default configuration for this plugin.

Returns
array An associative array with the default configuration.
}

Implements ConfigurablePluginInterface.

getSummary ( )

{Returns a render array summarizing the configuration of the image effect.

Returns
array A render array.
}

Implements ImageEffectInterface.

submitConfigurationForm ( array &  $form,
FormStateInterface  $form_state 
)

{Form submission handler.

Parameters
array$formAn associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the complete form.
}

Implements PluginFormInterface.

References FormStateInterface\getValue().

Here is the call graph for this function:

transformDimensions ( array &  $dimensions,
  $uri 
)

{Determines the dimensions of the styled image.

Parameters
array&$dimensionsDimensions 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.
string$uriOriginal 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.
}

Implements ImageEffectInterface.


The documentation for this class was generated from the following file: