public function ImageStylesWarmer::addQueue in Image Style Warmer 8
Add file and image styles to ImageStylesPregenerator queue.
Parameters
\Drupal\file\FileInterface $file: The file for which image styles should be created.
array $image_styles: List of image styles machine names.
Overrides ImageStylesWarmerInterface::addQueue
1 call to ImageStylesWarmer::addQueue()
- ImageStylesWarmer::warmUp in src/
ImageStylesWarmer.php - Init warm up with configured image styles for an image file.
File
- src/
ImageStylesWarmer.php, line 135
Class
- ImageStylesWarmer
- Defines an images styles warmer.
Namespace
Drupal\image_style_warmerCode
public function addQueue(FileInterface $file, array $image_styles) {
if (!empty($image_styles) && $this
->validateImage($file)) {
$queue = $this->queueFactory
->get('image_style_warmer_pregenerator');
$data = [
'file_id' => $file
->id(),
'image_styles' => $image_styles,
];
$queue
->createItem($data);
}
}