Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.0
Description: 

The image style system is flexible now. Contrib or custom modules are able to extend it or even replace it with their own implementation. A new interface (ImageStyleInterface) for image style configuration classes has been defined. Drupal 8 is shipped with ImageStyle as default class implementation of ImageStyleInterface. Legacy image style configurations from Drupal 7 were converted into configuration entities (configurables), instances of ImageStyle.

The image_style_deliver() was converted into a new download controller ImageStyleDownloadController being responsible with image derivatives delivery. By extending or overwritting this class you can implement custom permissions on image styles.

Old, procedural, functions were replaced by methods from ImageStyleInterface interface. Here's a conversion table:

Drupal 7 ImageStyle ImageStyleDownloadController
image_style_path() buildUri() -
image_style_url() buildUrl() -
image_style_flush() flush() -
image_style_create_derivative() createDerivative() -
image_style_transform_dimensions() transformDimensions() -
image_style_path_token() getPathToken() -
image_style_deliver() - deliver()

Note: Bolded methods are implementing ImageStyleInterface.

Find a derivative URI and URL

D7

<?php
$original_image
= 'public://images/image.jpg';
$uri = image_style_path('thumbnail', $original_image);
$url = image_style_url('thumbnail', $original_image);
?>

D8

<?php
$original_image
= 'public://images/image.jpg';
// Load the image style configuration entity.
$style = entity_load('image_style', 'thumbnail');
$uri = $style->buildUri($original_image);
$url = $style->buildUrl($original_image);
?>

Create a derivative image programmatically

D7

<?php
$original_image
= 'public://images/image.jpg';
$destination = image_style_path('thumbnail', $original_image);
image_style_create_derivative('thumbnail', $original_image, $destination);
?>

D8

<?php
$original_image
= 'public://images/image.jpg';
// Load the image style configuration entity.
$style = entity_load('image_style', 'thumbnail');
$destination = $style->buildUri($original_image);
$style->createDerivative($original_image, $destination);
?>
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Not done