Программно вывести пресет изображения в Drupal 8
Предположим что нам известен id файла изображения.
//не забываем 'style_name' => 'thumbnail', 'uri' => $file->getFileUri(), ); $image = \Drupal::service('image.factory')->get($variables['uri']); if ($image->isValid()) { $variables['width'] = $image->getWidth(); $variables['height'] = $image->getHeight(); } else { $variables['width'] = $variables['height'] = NULL; } $preset = [ '#theme' => 'image_style', '#width' => $variables['width'],