1 image.tokens.inc _image_token_generate_image($styled_uri, $type, $field_uri)

Helper function to generate image style if does not exist.

Parameters

string $styled_uri: URI for image style.

string $type: Machine name for image style.

string $field_uri: URI of field to be styled.

File

core/modules/image/image.tokens.inc, line 253
Builds placeholder replacement tokens for image styles.

Code

function _image_token_generate_image($styled_uri, $type, $field_uri) {
  // Only generate the image if it doesn't already exist.
  if (!file_exists($styled_uri)) {
    $style = image_style_load($type);
    // Create a derivative of the image for this style.
    image_style_create_derivative($style, $field_uri, $styled_uri);
  }
}