public function ImageStyleWithPipeline::createDerivative in Image Optimize (or ImageAPI Optimize) 8.3
Same name and namespace in other branches
- 8.2 src/Entity/ImageStyleWithPipeline.php \Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline::createDerivative()
- 4.x src/Entity/ImageStyleWithPipeline.php \Drupal\imageapi_optimize\Entity\ImageStyleWithPipeline::createDerivative()
Creates a new image derivative based on this image style.
Generates an image derivative applying all image effects and saving the resulting image.
Parameters
string $original_uri: Original image file URI.
string $derivative_uri: Derivative image file URI.
Return value
bool TRUE if an image derivative was generated, or FALSE if the image derivative could not be generated.
Overrides ImageStyle::createDerivative
File
- src/
Entity/ ImageStyleWithPipeline.php, line 20
Class
Namespace
Drupal\imageapi_optimize\EntityCode
public function createDerivative($original_uri, $derivative_uri) {
$result = parent::createDerivative($original_uri, $derivative_uri);
if ($result) {
// Apply the pipeline to the $derivative_uri.
if ($this
->hasPipeline()) {
$this
->getPipelineEntity()
->applyToImage($derivative_uri);
}
}
// Always return the result of the parent class processing.
return $result;
}